What is /etc/alternatives ?

I just ran a recursive grep on /etc to find where a strange IP address might be defined. Much to my surprise, I started seeing a bunch of messages like:

Binary file alternatives/jre_openjdk/lib/i386/server/libjvm.so matches

At first I was outraged that someone had put library files in /etc. Then I did `ls -l’ which showed that these are symlinks.

`rpm -q --whatprovides /etc/alternatives/jre_openjdk/lib/i386/server/libjvm.so’

Shows that this particular symlink was created by java-1_6_0-openjdk-

I see that not everything in /etc/alternative is java related. What is the purpose of this directory, and why is it in etc? Shouldn’t something like this be in /usr/lib, or similar?

It’s correct.
See man update-alternatives.

I take issue with the use of /etc for this purpose:

Linux Filesystem Hierarchy: /etc

This is the nerve center of your system, it contains all system related configuration files in here or in its sub-directories. A “configuration file” is defined as a local file used to control the operation of a program; it must be static and cannot be an executable binary. For this reason, it’s a good idea to backup this directory regularly. It will definitely save you a lot of re-configuration later if you re-install or lose your current installation. Normally, no binaries should be or are located here.

Lets not start to interpret documents as if we were lawyers.

/etc is configuration, and alternatives is all about configuration. It has been this way in every distro for more than a decade.

Every file in there is a symlink, the binaries are elsewhere.

And I’M accused of lawyering? What is certain is that the symlinks are not “local file[s] used to control the operation of a program”. I probably never noticed this directory because I was using my own install of virtually everything linked there. Mind you, I did not look at the FHS when I concluded this was the wrong place for the alternatives directory. I only looked at the FHS for confirmation.

I’m not the one accusing you of lawyering. Symlinks are not binaries, they are configuration, the way they are used here. Symlinks are also files, in Unix terminology, as are directories and device nodes.

But if you want to take it further, this is probably the wrong forum for it. Mind you, in the right forum you would be up against people who have thought about this already.

Where do Bodo and Lenz hang out these days?