update-alternatives - maintain symbolic links determining default commands
update-alternatives [ ''options''? --install link name path priority [ __--slave__ ''link name'' ''path''?...
update-alternatives [ ''options''? --remove name path
update-alternatives [ ''options''? --auto name
update-alternatives [ ''options''? --display name
update-alternatives [ ''options''? --config name
update-alternatives creates, removes, maintains and displays information about the symbolic links comprising the Debian alternatives system.
It is possible for several programs fulfilling the same or similar functions to be installed on a single system at the same time. For example, many systems have several text editors installed at once. This gives choice to the users of a system, allowing each to use a different editor, if desired, but makes it difficult for a program to make a good choice of editor to invoke if the user has not specified a particular preference.
Debian's alternatives system aims to solve this problem. A generic name in the filesystem is shared by all files providing interchangeable functionality. The alternatives system and the system administrator together determine which actual file is referenced by this generic name. For example, if the text editors ed(1) and nvi(1)? are both installed on the system, the alternatives system will cause the generic name /usr/bin/editor to refer to /usr/bin/nvi by default. The system administrator can override this and cause it to refer to /usr/bin/ed instead, and the alternatives system will not alter this setting until explicitly requested to do so.
The generic name is not a direct symbolic link to the selected alternative. Instead, it is a symbolic link to a name in the alternatives directory , which in turn is a symbolic link to the actual file referenced. This is done so that the system administrator's changes can be confined within the /etc directory: the FHS (q.v.) gives reasons why this is a Good Thing.
When each package providing a file with a particular functionality is installed, changed or removed, update-alternatives is called to update information about that file in the alternatives system. update-alternatives is usually called from the postinst or prerm scripts in Debian packages.
It is often useful for a number of alternatives to be synchronised, so that they are changed as a group; for example, when several versions of the vi(1) editor are installed, the man page referenced by /usr/share/man/man1/vi.1 should correspond to the executable referenced by /usr/bin/vi . update-alternatives handles this by means of master and slave links; when the master is changed, any associated slaves are changed too. A master link and its associated slaves make up a link group .
Each link group is, at any given time, in one of two modes: automatic or manual. When a group is in automatic mode, the alternatives system will automatically decide, as packages are installed and removed, whether and how to update the links. In manual mode, the alternatives system will not change the links; it will leave all the decisions to the system administrator.
Link groups are in automatic mode when they are first introduced to the system. If the system administrator makes changes to the system's automatic settings, this will be noticed the next time update-alternatives is run on the changed link's group, and the group will automatically be switched to manual mode.
Each alternative has a priority associated with it. When a link group is in automatic mode, the alternatives pointed to by members of the group will be those which have the highest priority.
When using the --config option, update-alternatives will list all of the choices for the link group of which given name is the master link. You will then be prompted for which of the choices to use for the link group. Once you make a change, the link group will no longer be in auto mode. You will need to use the --auto option in order to return to the automatic state.
Since the activities of update-alternatives are quite involved, some specific terms will help to explain its operation.
Exactly one action must be specified if update-alternatives is to perform any meaningful task. Any number of the common options may be specified together with any action.
update-alternatives chatters incessantly about its activities on its standard output channel. If problems occur, update-alternatives outputs error messages on its standard error channel and returns an exit status of 2. These diagnostics should be self-explanatory; if you do not find them so, please report this as a bug.
If you find a bug, please report it using the Debian bug-tracking system, or, if that is not possible, email the author directly.
If you find any discrepancy between the operation of update-alternatives and this manual page, it is a bug, either in the implementation or the documentation; please report it.
Debian update-alternatives is copyright 1995 Ian Jackson. It is free software; see the GNU General Public Licence version 2 or later for copying conditions. There is NO warranty.
This manual page is copyright 1997/98 Charles Briscoe-Smith. This is free documentation; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY.
You can find the GNU GPL in /usr/share/common-licenses/GPL on any Debian system.
ln(1), FHS, the Filesystem Hierarchy Standard.
I manually installed and compiled a newer version of wxWidgets, and I wanted it to "play nice" with the older version I had installed.
$ ls -ld /usr/bin/wx-config lrwxrwxrwx 1 root root 27 2002-07-14 22:32 /usr/bin/wx-config
/etc/alternatives/wx-config
So the wx-config script is handled by the alternatives system.
$ /usr/sbin/update-alternatives --display wx-config wx-config - status is auto.
link currently points to /usr/bin/wxbase-2.2-config
/usr/bin/wxbase-2.2-config - priority 60 Current `best' version is /usr/bin/wxbase-2.2-config.
So. Install a link to my wx-config from a later version. (Remember - Usage: update-alternatives --install <link> <name> <path> <priority>)
(I need a higher priority than 60 to be chosen of the wxbase-2.2 one from the debian package).
$ /usr/sbin/update-alternatives --display wx-config wx-config - status is auto.
link currently points to /usr/local/bin/wxgtk2u-2.4-config
/usr/bin/wxbase-2.2-config - priority 60 /usr/local/bin/wxgtk2u-2.4-config - priority 70 Current `best' version is /usr/local/bin/wxgtk2u-2.4-config.
$ update-alternatives --install /usr/bin/www-browser www-browser
/usr/bin/lynx 70 --slave /usr/share/man/man1/www-browser.1.gz www-browser.1.gz /usr/share/man/man1/lynx.1.gz
now
$ man www-browser
will show lynx(1) man page.
3 pages link to update-alternatives(8):