MAN page from OpenSuSE update-alternatives-1.16.10-7.1.36.x86_64.rpm
Section: dpkg utilities (8)
update-alternatives - maintain symbolic links determining default commands
creates, removes, maintains and displays information about the symboliclinks comprising the SuSE alternatives system.
It is possible for several programs fulfilling the same or similarfunctions 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 adifferent editor, if desired, but makes it difficult for a programto make a good choice for an editor to invoke if theuser has not specified a particular preference.
SuSE's alternatives system aims to solve this problem.A generic name in the filesystem isshared by all files providing interchangeable functionality.The alternatives system and the system administratortogether determine which actual file is referenced by this generic name.For example, if the text editorsed(1)andnvi(1)are both installed on the system, the alternatives system will causethe generic name/usr/bin/editorto refer to/usr/bin/nviby default. The system administrator can override this and causeitto refer to/usr/bin/edinstead,and the alternatives system will not alter this setting until explicitlyrequested 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 thealternativesdirectory,which in turn is a symbolic link to the actual file referenced.This is done so that the system administrator's changes can be confinedwithin the/etcdirectory: the FHS (q.v.) gives reasons why this is a Good Thing.
When each packageproviding a file with a particular functionality isinstalled, changed or removed,update-alternativesis called to update information about that file in the alternatives system.update-alternativesis usually called from thepost(configure) orpreun(install) scripts in SuSE packages.
It is often useful for a number of alternatives to be synchronized,so that they are changed as a group; for example, when several versionsof thevi(1)editor are installed, the man page referenced by/usr/share/man/man1/vi.1should correspond to the executable referenced by/usr/bin/vi.update-alternativeshandles this by means ofmasterandslavelinks; when the master is changed, any associated slaves are changedtoo.A master link and its associated slaves make up alinkgroup.
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 willautomatically decide, as packages are installed and removed,whether and how to update the links.In manual mode, the alternatives system will retain the choice ofthe administrator and avoid changing the links (except when something isbroken).
Link groups are in automatic mode when they are first introduced tothe system.If the system administrator makes changes to the system'sautomatic settings,this will be noticed the next timeupdate-alternativesis run on the changed link's group,and the group will automatically be switched to manual mode.
Each alternative has apriorityassociated with it.When a link group is in automatic mode,the alternatives pointed to by members of the groupwill be those which have the highest priority.
When using the--configoption,update-alternativeswill list all of the choices for the link groupof which givennameis the master alternative name. The current choice is marked with a '*'.You will then be prompted for your choice regarding this link group.Depending on the choice made, the link group might no longer be inautomode. You will need to use the--autooption in order to return to the automatic mode (or you can rerun--configand select the entry marked as automatic).
If you want to configure non-interactively you can use the--setoption instead (see below).
Different packages providing the same file need to do socooperatively.In other words, the usage ofupdate-alternativesismandatoryfor all involved packages in such case. It is not possible tooverride some file in a package that does not employ theupdate-alternativesmechanism.
Since the activities ofupdate-alternatives
are quite involved, some specific terms will help to explain itsoperation.
- generic name (or alternative link)
- A name, like/usr/bin/editor,which refers, via the alternatives system, to one of a number offiles of similar function.
- alternative name
- The name of a symbolic link in the alternatives directory.
- alternative (or alternative path)
- The name of a specific file in the filesystem, which may be madeaccessible via a generic name using the alternatives system.
- alternatives directory
- A directory, by default/etc/alternatives,containing the symlinks.
- administrative directory
- A directory, by default/var/lib/rpm/alternatives,containingupdate-alternatives'state information.
- link group
- A set of related symlinks, intended to be updated as a group.
- master link
- The alternative link in a link group which determines how the other links in thegroup are configured.
- slave link
- An alternative link in a link group which is controlled by the setting ofthe master link.
- automatic mode
- When a link group is in automatic mode,the alternatives system ensures that the links in the grouppoint to the highest priority alternativeappropriate for the group.
- manual mode
- When a link group is in manual mode,the alternatives system will not make any changesto the system administrator's settings.
- --install link name path priority [--slave link name path]...
- Add a group of alternatives to the system.linkis the generic name for the master link,nameis the name of its symlink in the alternatives directory, andpathis the alternative being introduced for the master link.The arguments after --slave are the generic name, symlink name in thealternatives directory and the alternative path for a slave link.Zero or more--slaveoptions, each followed by three arguments,may be specified. Note that the master alternative must exist or the callwill fail. However if a slave alternative doesn't exist, the correspondingslave alternative link will simply not be installed (a warning will stillbe displayed). If some real file is installed where an alternative linkhas to be installed, it is kept unless --force is used.
- If the alternative name specified exists alreadyin the alternatives system's records,the information supplied will be added as a newset of alternatives for the group.Otherwise, a new group, set to automatic mode,will be added with this information.If the group is in automatic mode,and the newly added alternatives' priority is higher thanany other installed alternatives for this group,the symlinks will be updated to point to the newly added alternatives.
- --set name path
- Set the programpathas alternative forname.This is equivalent to--configbut is non-interactive and thus scriptable.
- --remove name path
- Remove an alternative and all of its associated slave links.nameis a name in the alternatives directory, andpathis an absolute filename to whichnamecould be linked. Ifnameis indeed linked topath,namewill be updated to point to another appropriate alternative(and the group is put back in automatic mode), orremoved if there is no such alternative left.Associated slave links will be updated or removed, correspondingly.If the link is not currently pointing topath,no links are changed;only the information about the alternative is removed.
- --remove-all name
- Remove all alternatives and all of their associated slave links.nameis a name in the alternatives directory.
- Call --config on all alternatives. It can be usefully combined with--skip-auto to review and configure all alternatives which arenot configured in automatic mode. Broken alternatives are also displayed.Thus a simple way to fix all broken alternatives is to callyes [aq][aq] | update-alternatives --force --all.
- --auto name
- Switch the link group behind the alternative fornameto automatic mode.In the process, the master symlink and its slaves are updatedto point to the highest priority installed alternatives.
- --display name
- Display information about the link group.Information displayed includes the group's mode(auto or manual),which alternative the master link currently points to,what other alternatives are available(and their corresponding slave alternatives),and the highest priority alternative currently installed.
- List all master alternative names (those controlling a link group)and their status. Each line contains up to 3 fields (separated byone or more spaces). The first field is the alternative name, the secondone is the status (either "auto" or "manual"), and the last one containsthe current choice in the alternative (beware: it's a filename and thusmight contain spaces).
- Read configuration of alternatives on standard input in the formatgenerated by update-alternatives --get-selections and reconfigurethem accordingly.
- --query name
- Display information about the link grouplike --display does, but in a machine parseable way(see section QUERY FORMAT below).
- --list name
- Display all targets of the link group.
- --config name
- Show available alternatives for a link group and allow the user tointeractively select which one to use. The link group is updated.
- Show the usage message and exit.
- Show the version and exit.
- --altdir directory
- Specifies the alternatives directory, when this is to bedifferent from the default.
- --admindir directory
- Specifies the administrative directory, when this is to bedifferent from the default.
- --log file
- Specifies the log file, when this is to be different from the default(/var/log/alternatives.log).
- Let update-alternatives replace or drop any real file that is installedwhere an alternative link has to be installed or removed.
- Skip configuration prompt for alternatives which are properly configuredin automatic mode. This option is only relevant with --config or--all.
- Generate more comments about whatupdate-alternativesis doing.
- Don't generate any comments unless errors occur.
- If set and the --admindir option has not been specified, it willbe used as the base administrative directory.
- The default alternatives directory.Can be overridden by the--altdiroption.
- The default administration directory.Can be overridden by the--admindiroption.
- The requested action was successfully performed.
- Problems were encountered whilst parsing the command lineor performing the action.
The update-alternatives --query
format is using anRFC822-like flat format. It's made of n
+ 1 blocks where n
isthe number of alternatives available in the queried link group. The firstblock contains the following fields:
- Name: name
- The alternative name in the alternative directory.
- Link: link
- The generic name of the alternative.
- Slaves: list-of-slaves
- When this field is present, the next lines hold all slave linksassociated to the master link of the alternative. There is one slave perline. Each line contains one space, the generic name of the slavealternative, another space, and the path to the slave link.
- Status: status
- The status of the alternative (auto or manual).
- Best: best-choice
- The path of the best alternative for this link group. Not present ifthere is no alternatives available.
- Value: currently-selected-alternative
- The path of the currently selected alternative. It can also take the magicvalue none. It is used if the link doesn't exist.
- The other blocks describe the available alternatives in the queried link group:
- Alternative: path-of-this-alternative
- Path to this block's alternative.
- Priority: priority-value
- Value of the priority of this alternative.
- Slaves: list-of-slaves
- When this header is present, the next lines hold all slave alternativesassociated to the master link of the alternative. There is one slave perline. Each line contains one space, the generic name of the slavealternative, another space, and the path to the slave alternative.
$ update-alternatives --query editorName: editorLink: /usr/bin/editorSlaves: editor.1.gz /usr/share/man/man1/editor.1.gz editor.fr.1.gz /usr/share/man/fr/man1/editor.1.gz editor.it.1.gz /usr/share/man/it/man1/editor.1.gz editor.pl.1.gz /usr/share/man/pl/man1/editor.1.gz editor.ru.1.gz /usr/share/man/ru/man1/editor.1.gzStatus: autoBest: /usr/bin/vim.basicValue: /usr/bin/vim.basicAlternative: /bin/edPriority: -100Slaves: editor.1.gz /usr/share/man/man1/ed.1.gzAlternative: /usr/bin/vim.basicPriority: 50Slaves: editor.1.gz /usr/share/man/man1/vim.1.gz editor.fr.1.gz /usr/share/man/fr/man1/vim.1.gz editor.it.1.gz /usr/share/man/it/man1/vim.1.gz editor.pl.1.gz /usr/share/man/pl/man1/vim.1.gz editor.ru.1.gz /usr/share/man/ru/man1/vim.1.gz
chatters incessantly about its activities on its standard output channel.If problems occur,update-alternatives
outputs error messages on its standard error channel andreturns an exit status of 2.These diagnostics should be self-explanatory;if you do not find them so, please report this as a bug.
There are several packages which provide a text editor compatiblewith vi
, for example nvi
. Which one is usedis controlled by the link group vi
, which includes links for theprogram itself and the associated manpage.
To display the available packages which provide vi and the currentsetting for it, use the --display action:
update-alternatives --display vi
To choose a particular vi implementation, use this command as rootand then select a number from the list:
update-alternatives --config vi
To go back to having the vi implementation chosen automatically, dothis as root:
update-alternatives --auto vi
If you find a bug, please report it using the SuSE bug-tracking system.
If you find any discrepancy between the operation ofupdate-alternativesand this manual page, it is a bug,either in the implementation or the documentation; please report it.
(1),FHS, the Filesystem Hierarchy Standard.
- EXIT STATUS
- QUERY FORMAT
- SEE ALSO
This document was created byman2html,using the manual pages.