.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "update-alternatives 1" .TH update-alternatives 1 "2022-09-01" "1.20.12" "dpkg suite" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" update\-alternatives \- maintain symbolic links determining default commands .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBupdate-alternatives\fR [\fIoption\fR...] \fIcommand\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fBupdate-alternatives\fR creates, removes, maintains and displays information about the symbolic links comprising the Debian alternatives system. .PP 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 for an editor to invoke if the user has not specified a particular preference. .PP 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 \&\fBed\fR(1) and \&\fBnvi\fR(1) are both installed on the system, the alternatives system will cause the generic name \&\fI/usr/bin/editor\fR to refer to \&\fI/usr/bin/nvi\fR by default. The system administrator can override this and cause it to refer to \&\fI/usr/bin/ed\fR instead, and the alternatives system will not alter this setting until explicitly requested to do so. .PP The generic name is not a direct symbolic link to the selected alternative. Instead, it is a symbolic link to a name in the \&\fIalternatives\fR \&\fIdirectory\fR, 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 \&\fI/etc\fR directory: the \s-1FHS\s0 (q.v.) gives reasons why this is a Good Thing. .PP When each package providing a file with a particular functionality is installed, changed or removed, \&\fBupdate-alternatives\fR is called to update information about that file in the alternatives system. \&\fBupdate-alternatives\fR is usually called from the following Debian package maintainer scripts, \&\fBpostinst\fR (configure) to install the alternative and from \&\fBprerm\fR and \fBpostrm\fR (remove) to remove the alternative. \&\fBNote:\fR in most (if not all) cases no other maintainer script actions should call \fBupdate-alternatives\fR, in particular neither of \fBupgrade\fR nor \&\fBdisappear\fR, as any other such action can lose the manual state of an alternative, or make the alternative temporarily flip-flop, or completely switch when several of them have the same priority. .PP It is often useful for a number of alternatives to be synchronized, so that they are changed as a group; for example, when several versions of the \&\fBvi\fR(1) editor are installed, the man page referenced by \&\fI/usr/share/man/man1/vi.1\fR should correspond to the executable referenced by \&\fI/usr/bin/vi\fR. \&\fBupdate-alternatives\fR handles this by means of \&\fImaster\fR and \&\fIslave\fR links; when the master is changed, any associated slaves are changed too. A master link and its associated slaves make up a \&\fIlink\fR \&\fIgroup\fR. .PP 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 retain the choice of the administrator and avoid changing the links (except when something is broken). .PP 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 \&\fBupdate-alternatives\fR is run on the changed link's group, and the group will automatically be switched to manual mode. .PP Each alternative has a \&\fIpriority\fR 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. .PP When using the \&\fB\-\-config\fR option, \&\fBupdate-alternatives\fR will list all of the choices for the link group of which given \&\fIname\fR is the master alternative name. The current choice is marked with a \(oq*\(cq. You will then be prompted for your choice regarding this link group. Depending on the choice made, the link group might no longer be in \&\fIauto\fR mode. You will need to use the \&\fB\-\-auto\fR option in order to return to the automatic mode (or you can rerun \&\fB\-\-config\fR and select the entry marked as automatic). .PP If you want to configure non-interactively you can use the \&\fB\-\-set\fR option instead (see below). .PP Different packages providing the same file need to do so \&\fBcooperatively\fR. In other words, the usage of \&\fBupdate-alternatives\fR is \&\fBmandatory\fR for all involved packages in such case. It is not possible to override some file in a package that does not employ the \&\fBupdate-alternatives\fR mechanism. .SH "TERMINOLOGY" .IX Header "TERMINOLOGY" Since the activities of \&\fBupdate-alternatives\fR are quite involved, some specific terms will help to explain its operation. .IP "generic name (or alternative link)" 4 .IX Item "generic name (or alternative link)" A name, like \&\fI/usr/bin/editor\fR, which refers, via the alternatives system, to one of a number of files of similar function. .IP "alternative name" 4 .IX Item "alternative name" The name of a symbolic link in the alternatives directory. .IP "alternative (or alternative path)" 4 .IX Item "alternative (or alternative path)" The name of a specific file in the filesystem, which may be made accessible via a generic name using the alternatives system. .IP "alternatives directory" 4 .IX Item "alternatives directory" A directory, by default \&\fI/etc/alternatives\fR, containing the symlinks. .IP "administrative directory" 4 .IX Item "administrative directory" A directory, by default \&\fI/var/lib/dpkg/alternatives\fR, containing \&\fBupdate-alternatives\fR' state information. .IP "link group" 4 .IX Item "link group" A set of related symlinks, intended to be updated as a group. .IP "master link" 4 .IX Item "master link" The alternative link in a link group which determines how the other links in the group are configured. .IP "slave link" 4 .IX Item "slave link" An alternative link in a link group which is controlled by the setting of the master link. .IP "automatic mode" 4 .IX Item "automatic mode" When a link group is in automatic mode, the alternatives system ensures that the links in the group point to the highest priority alternative appropriate for the group. .IP "manual mode" 4 .IX Item "manual mode" When a link group is in manual mode, the alternatives system will not make any changes to the system administrator's settings. .SH "COMMANDS" .IX Header "COMMANDS" .IP "\fB\-\-install\fR \fIlink name path priority\fR [\fB\-\-slave\fR \fIlink name path\fR]..." 4 .IX Item "--install link name path priority [--slave link name path]..." Add a group of alternatives to the system. \&\fIlink\fR is the generic name for the master link, \&\fIname\fR is the name of its symlink in the alternatives directory, and \&\fIpath\fR is the alternative being introduced for the master link. The arguments after \fB\-\-slave\fR are the generic name, symlink name in the alternatives directory and the alternative path for a slave link. Zero or more \&\fB\-\-slave\fR options, each followed by three arguments, may be specified. Note that the master alternative must exist or the call will fail. However if a slave alternative doesn't exist, the corresponding slave alternative link will simply not be installed (a warning will still be displayed). If some real file is installed where an alternative link has to be installed, it is kept unless \fB\-\-force\fR is used. .Sp If the alternative name specified exists already in the alternatives system's records, the information supplied will be added as a new set 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 than any other installed alternatives for this group, the symlinks will be updated to point to the newly added alternatives. .IP "\fB\-\-set\fR \fIname path\fR" 4 .IX Item "--set name path" Set the program \&\fIpath\fR as alternative for \&\fIname\fR. This is equivalent to \&\fB\-\-config\fR but is non-interactive and thus scriptable. .IP "\fB\-\-remove\fR \fIname path\fR" 4 .IX Item "--remove name path" Remove an alternative and all of its associated slave links. \&\fIname\fR is a name in the alternatives directory, and \&\fIpath\fR is an absolute filename to which \&\fIname\fR could be linked. If \&\fIname\fR is indeed linked to \&\fIpath\fR, \&\fIname\fR will be updated to point to another appropriate alternative (and the group is put back in automatic mode), or removed if there is no such alternative left. Associated slave links will be updated or removed, correspondingly. If the link is not currently pointing to \&\fIpath\fR, no links are changed; only the information about the alternative is removed. .IP "\fB\-\-remove\-all\fR \fIname\fR" 4 .IX Item "--remove-all name" Remove all alternatives and all of their associated slave links. \&\fIname\fR is a name in the alternatives directory. .IP "\fB\-\-all\fR" 4 .IX Item "--all" Call \fB\-\-config\fR on all alternatives. It can be usefully combined with \&\fB\-\-skip\-auto\fR to review and configure all alternatives which are not configured in automatic mode. Broken alternatives are also displayed. Thus a simple way to fix all broken alternatives is to call \&\fByes '' | update-alternatives \-\-force \-\-all\fR. .IP "\fB\-\-auto\fR \fIname\fR" 4 .IX Item "--auto name" Switch the link group behind the alternative for \&\fIname\fR to automatic mode. In the process, the master symlink and its slaves are updated to point to the highest priority installed alternatives. .IP "\fB\-\-display\fR \fIname\fR" 4 .IX Item "--display name" Display information about the link group. Information displayed includes the group's mode (auto or manual), the master and slave links, 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. .IP "\fB\-\-get\-selections\fR" 4 .IX Item "--get-selections" List all master alternative names (those controlling a link group) and their status (since version 1.15.0). Each line contains up to 3 fields (separated by one or more spaces). The first field is the alternative name, the second one is the status (either \fBauto\fR or \fBmanual\fR), and the last one contains the current choice in the alternative (beware: it's a filename and thus might contain spaces). .IP "\fB\-\-set\-selections\fR" 4 .IX Item "--set-selections" Read configuration of alternatives on standard input in the format generated by \fB\-\-get\-selections\fR and reconfigure them accordingly (since version 1.15.0). .IP "\fB\-\-query\fR \fIname\fR" 4 .IX Item "--query name" Display information about the link group like \fB\-\-display\fR does, but in a machine parseable way (since version 1.15.0, see section \fB\s-1QUERY FORMAT\s0\fR below). .IP "\fB\-\-list\fR \fIname\fR" 4 .IX Item "--list name" Display all targets of the link group. .IP "\fB\-\-config\fR \fIname\fR" 4 .IX Item "--config name" Show available alternatives for a link group and allow the user to interactively select which one to use. The link group is updated. .IP "\fB\-\-help\fR" 4 .IX Item "--help" Show the usage message and exit. .IP "\fB\-\-version\fR" 4 .IX Item "--version" Show the version and exit. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-\-altdir\fR \fIdirectory\fR" 4 .IX Item "--altdir directory" Specifies the alternatives directory, when this is to be different from the default. Defaults to \(Fo\fI/etc/alternatives\fR\(Fc. .IP "\fB\-\-admindir\fR \fIdirectory\fR" 4 .IX Item "--admindir directory" Specifies the administrative directory, when this is to be different from the default. Defaults to \(Fo\fI/var/lib/dpkg/alternatives\fR\(Fc .IP "\fB\-\-instdir\fR \fIdirectory\fR" 4 .IX Item "--instdir directory" Specifies the installation directory where alternatives links will be created (since version 1.20.1). Defaults to \(Fo\(Fc. .IP "\fB\-\-root\fR \fIdirectory\fR" 4 .IX Item "--root directory" Specifies the root directory (since version 1.20.1). This also sets the alternatives, installation and administrative directories to match. Defaults to \(Fo\(Fc. .IP "\fB\-\-log\fR \fIfile\fR" 4 .IX Item "--log file" Specifies the log file (since version 1.15.0), when this is to be different from the default (/var/log/alternatives.log). .IP "\fB\-\-force\fR" 4 .IX Item "--force" Allow replacing or dropping any real file that is installed where an alternative link has to be installed or removed. .IP "\fB\-\-skip\-auto\fR" 4 .IX Item "--skip-auto" Skip configuration prompt for alternatives which are properly configured in automatic mode. This option is only relevant with \fB\-\-config\fR or \&\fB\-\-all\fR. .IP "\fB\-\-quiet\fR" 4 .IX Item "--quiet" Do not generate any comments unless errors occur. .IP "\fB\-\-verbose\fR" 4 .IX Item "--verbose" Generate more comments about what is being done. .IP "\fB\-\-debug\fR" 4 .IX Item "--debug" Generate even more comments, helpful for debugging, about what is being done (since version 1.19.3). .SH "EXIT STATUS" .IX Header "EXIT STATUS" .IP "\fB0\fR" 4 .IX Item "0" The requested action was successfully performed. .IP "\fB2\fR" 4 .IX Item "2" Problems were encountered whilst parsing the command line or performing the action. .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" .IP "\fB\s-1DPKG_ADMINDIR\s0\fR" 4 .IX Item "DPKG_ADMINDIR" If set and the \fB\-\-admindir\fR option has not been specified, it will be used as the base administrative directory. .SH "FILES" .IX Header "FILES" .IP "\fI/etc/alternatives/\fR" 4 .IX Item "/etc/alternatives/" The default alternatives directory. Can be overridden by the \&\fB\-\-altdir\fR option. .IP "\fI/var/lib/dpkg/alternatives/\fR" 4 .IX Item "/var/lib/dpkg/alternatives/" The default administration directory. Can be overridden by the \&\fB\-\-admindir\fR option. .SH "QUERY FORMAT" .IX Header "QUERY FORMAT" The \fB\-\-query\fR format is using an RFC822\-like flat format. It's made of \fIn\fR + 1 blocks where \fIn\fR is the number of alternatives available in the queried link group. The first block contains the following fields: .IP "\fBName:\fR \fIname\fR" 4 .IX Item "Name: name" The alternative name in the alternative directory. .IP "\fBLink:\fR \fIlink\fR" 4 .IX Item "Link: link" The generic name of the alternative. .IP "\fBSlaves:\fR \fIlist-of-slaves\fR" 4 .IX Item "Slaves: list-of-slaves" When this field is present, the \fBnext\fR lines hold all slave links associated to the master link of the alternative. There is one slave per line. Each line contains one space, the generic name of the slave alternative, another space, and the path to the slave link. .IP "\fBStatus:\fR \fIstatus\fR" 4 .IX Item "Status: status" The status of the alternative (\fBauto\fR or \fBmanual\fR). .IP "\fBBest:\fR \fIbest-choice\fR" 4 .IX Item "Best: best-choice" The path of the best alternative for this link group. Not present if there is no alternatives available. .IP "\fBValue:\fR \fIcurrently-selected-alternative\fR" 4 .IX Item "Value: currently-selected-alternative" The path of the currently selected alternative. It can also take the magic value \fBnone\fR. It is used if the link doesn't exist. .PP The other blocks describe the available alternatives in the queried link group: .IP "\fBAlternative:\fR \fIpath-of-this-alternative\fR" 4 .IX Item "Alternative: path-of-this-alternative" Path to this block's alternative. .IP "\fBPriority:\fR \fIpriority-value\fR" 4 .IX Item "Priority: priority-value" Value of the priority of this alternative. .IP "\fBSlaves:\fR \fIlist-of-slaves\fR" 4 .IX Item "Slaves: list-of-slaves" When this field is present, the \fBnext\fR lines hold all slave alternatives associated to the master link of the alternative. There is one slave per line. Each line contains one space, the generic name of the slave alternative, another space, and the path to the slave alternative. .SS "Example" .IX Subsection "Example" .Vb 12 \& $ update\-alternatives \-\-query editor \& Name: editor \& Link: /usr/bin/editor \& Slaves: \& 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.gz \& Status: auto \& Best: /usr/bin/vim.basic \& Value: /usr/bin/vim.basic \& \& Alternative: /bin/ed \& Priority: \-100 \& Slaves: \& editor.1.gz /usr/share/man/man1/ed.1.gz \& \& Alternative: /usr/bin/vim.basic \& Priority: 50 \& Slaves: \& 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 .Ve .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" With \fB\-\-verbose\fR \&\fBupdate-alternatives\fR chatters incessantly about its activities on its standard output channel. If problems occur, \&\fBupdate-alternatives\fR 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. .SH "EXAMPLES" .IX Header "EXAMPLES" There are several packages which provide a text editor compatible with \fBvi\fR, for example \fBnvi\fR and \fBvim\fR. Which one is used is controlled by the link group \fBvi\fR, which includes links for the program itself and the associated manpage. .PP To display the available packages which provide \fBvi\fR and the current setting for it, use the \fB\-\-display\fR action: .Sp .Vb 1 \& update\-alternatives \-\-display vi .Ve .PP To choose a particular \fBvi\fR implementation, use this command as root and then select a number from the list: .Sp .Vb 1 \& update\-alternatives \-\-config vi .Ve .PP To go back to having the \fBvi\fR implementation chosen automatically, do this as root: .Sp .Vb 1 \& update\-alternatives \-\-auto vi .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBln\fR(1), \&\s-1FHS\s0 (the Filesystem Hierarchy Standard).