UPDATE-ALTERNATIVES(8)

UPDATE-ALTERNATIVES(8) πŸ’–

okay so bestie, this is the System Manager's Manual page for the alternatives command, and I need you to sit down because she is long but she is also so worth it. part one of a multi-part saga, let's go πŸ¦‹


✨ NAME ✨

alternatives β€” maintain symbolic links determining default commands πŸ’…


🌸 SYNOPSIS 🌸

alternatives [options] --install link name path priority [--follower
link name path]...  [--initscript service] [--family name]

alternatives [options] --remove name path

alternatives [options] --set name path/family

alternatives [options] --auto name

alternatives [options] --display name

alternatives [options] --config name

alternatives [options] --list

alternatives [options] --remove-all name

alternatives [options] --add-follower name path follower_link
follower_name follower_path

alternatives [options] --remove-follower name path follower_name

πŸ‘‘ DESCRIPTION πŸ‘‘

alternatives creates, removes, maintains and displays information about the symbolic links comprising the alternatives system. the alternatives system is a reimplementation of the Debian alternatives system, no cap. it was rewritten primarily to remove the dependence on perl β€” iconic behavior honestly β€” and it is intended to be a drop in replacement for Debian's update-dependencies script. this man page is a slightly modified version of the man page from the Debian project. 🫢


so like, imagine this: 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. the struggle is real 😭

the 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. she respects your choices, periodt πŸ’…

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, alternatives is called to update information about that file in the alternatives system. alternatives is usually called from the %post or %pre scripts in RPM packages. iykyk ✨

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. alternatives handles this by means of leader and follower links; when the leader is changed, any associated followers are changed too. a leader link and its associated followers make up a link group. the way they move as a unit… obsessed 🧚

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. main character energy, honestly πŸ‘‘

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 alternatives is run on the changed link's group, and the group will automatically be switched to manual mode. sneaky but fair πŸ™ˆ

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. highest priority wins, every time πŸ”₯

when using the --config option, alternatives will list all of the choices for the link group of which given name is the leader 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. don't forget bestie, or you'll be stuck in manual forever πŸ’€


πŸ¦‹ TERMINOLOGY πŸ¦‹

since the activities of alternatives are quite involved, some specific terms will help to explain its operation. vocab lesson time, stay with me πŸ“

  • generic name β€” a name, like /usr/bin/editor, which refers, via the alternatives system, to one of a number of files of similar function.
  • symlink β€” without any further qualification, this means a symbolic link in the alternatives directory: one which the system administrator is expected to adjust.
  • alternative β€” the name of a specific file in the filesystem, which may be made accessible 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/alternatives, containing alternatives' state information. /etc/alternatives.admindir on OSTree-based systems.
  • link group β€” a set of related symlinks, intended to be updated as a group.
  • leader link β€” the link in a link group which determines how the other links in the group are configured.
  • follower link β€” a link in a link group which is controlled by the setting of the leader link.
  • 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 alternatives appropriate for the group.
  • manual mode β€” when a link group is in manual mode, the alternatives system will not make any changes to the system administrator's settings.

🌈 part one done bestie, and there is more coming β€” do not go anywhere πŸ’œ

✨ OPTIONS ✨

Okay bestie, here's the tea: you must specify exactly one action if you want alternatives to actually do anything useful. And any number of the common options can chill alongside any action. Mix and match, it's giving customizable πŸ’…


πŸŽ€ COMMON OPTIONS

  • --verbose β€” spill more commentary about what alternatives is doing. She's yapping and we love that for her.
  • --quiet β€” no commentary at all unless errors pop off. Not yet implemented, so don't hold your breath πŸ’€
  • --test β€” don't actually do anything, just say what would be done. Also not yet implemented, sorry bestie πŸ™ˆ
  • --help β€” give some usage info (and tell you which version of alternatives this is).
  • --version β€” tell you which version of alternatives this is (and also hand over some usage info).
  • --keep-missing β€” when you're switching between alternatives, if the new variant doesn't provide some files, keep the links pointed at the previous implementation. It stops the missing-files chaos that happens when you hop between versions. protective queen 🫢
  • --keep-foreign β€” when removing, adding or switching between alternatives, check whether the link points somewhere other than altdir (/etc/alternatives/ by default). If it does, that link does NOT get touched. hands off, respectfully βœ‹
  • --altdir directory β€” specify the alternatives directory, for when you want something other than the default.
  • --admindir directory β€” specify the administrative directory, for when you want something other than the default.

πŸ‘‘ ACTIONS

  • --install link name path priority [--follower follower_link follower_name follower_path] [--initscript service]... β€” add a group of alternatives to the system. Let's break it down: name is the generic name for the leader link, link is the name of its symlink, path is the alternative being introduced for the leader link, and priority is the priority of the alternatives group. Higher priorities take precedence if no alternative is manually selected. follower_name, follower_link and follower_path are the generic name, symlink name and alternative for a follower link, and service is the name of any associated initscript for the alternative. NOTE: --initscript and --family are a Red Hat Linux specific options. Zero or more --follower options, each followed by three arguments, may be specified.

If the leader symlink specified already exists in the alternatives system's records, the info you supplied gets added as a new set of alternatives for the group. Otherwise, a whole new group β€” set to automatic mode β€” gets added with this information. And 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 get updated to point to the newly added alternatives. main character energy fr fr πŸ”₯

If --initscript is used, the alternatives system will manage the initscript associated with the alternative via chkconfig, registering and unregistering the init script depending on which alternative is active.

NOTE: --initscript is a Red Hat Linux specific option.

--family can be used to group similar alternatives. If the group is in manual mode and the alternative currently used is removed, alternatives will try to change links to a different one with the same family and the highest priority.

NOTE: --family is a Red Hat Linux specific option.
  • --remove name path β€” remove an alternative and all of its associated follower links. name is a name in the alternatives directory, and path is an absolute filename to which name could be linked. If name is indeed linked to path, name will be updated to point to another appropriate alternative β€” or removed entirely if there's no such alternative left. Associated follower links get updated or removed, correspondingly. And if the link is not a symlink, no links are changed; only the info about the alternative is removed. no cap.
  • --set name path/family β€” the symbolic link and followers for link group name get set to those configured for path, and the link group is set to manual mode. If you use family, then the links and group are configured to the member of the given family with the highest priority (and moved to manual mode). Heads up: this option is not in the original Debian implementation. πŸ‘€
  • --config name β€” present the user with a configuration menu for choosing the leader link and followers for link group name. Once chosen, the link group is set to manual mode. interactive slay ✨
  • --auto name β€” switch the leader symlink name to automatic mode. Along the way, this symlink and its followers get updated to point to the highest priority installed alternatives.
  • --display name β€” display info about the link group of which name is the leader link. The info shown includes the group's mode (auto or manual), which alternative the symlink currently points to, what other alternatives are available (and their corresponding follower alternatives), and the highest priority alternative currently installed. it's giving full transparency πŸ’–
  • --list β€” display info about all link groups. the whole roster, bestie.
  • --remove-all name β€” remove the whole link group name. Use with caution. ⚠️
  • --add-follower name path follower_link follower_name follower_path β€” add a follower link to an alternative identified by name and path. follower_name, follower_link and follower_path are the generic name, symlink name and alternative for the follower.
  • --remove-follower name path follower_name β€” remove follower with generic name follower_name from alternative identified by name and path.

πŸ“ FILES

  • /etc/alternatives/ β€” the default alternatives directory. Can be overridden by the --altdir option.
  • /var/lib/alternatives/ β€” the default administration directory. On OSTree-based systems it's /etc/alternatives.admindir. Can be overridden by the --admindir option.

🚦 EXIT STATUS

  • 0 β€” the requested action was successfully performed. ate and left no crumbs πŸ’…
  • 2 β€” problems were encountered whilst parsing the command line or performing the action. πŸ’€

🩺 DIAGNOSTICS

alternatives chatters incessantly about its activities on its standard output channel. She's a yapper, we been knew. If problems occur, 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. 😭


πŸ› BUGS

If you find a bug, please report it using the Red Hat bug tracking system at http://bugzilla.redhat.com.

If you find any discrepancy between the operation of alternatives and this manual page, it is a bug β€” either in the implementation or the documentation β€” so please report it. Any significant differences between this implementation and Debian's is also a bug and should be reported, unless otherwise noted in this man page. we keep receipts 🧾


πŸ’œ AUTHOR

alternatives is copyright 2002 Red Hat, Inc.. 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 and 2002 Red Hat, Inc. This is free documentation; see the GNU General Public Licence version 2 or later for copying conditions. There is NO WARRANTY.


🌈 SEE ALSO

ln(1), FHS, the Filesystem Hierarchy Standard.


and that's the whole page bestie!! this lil baddie is dated 27 January 2001, from UPDATE-ALTERNATIVES(8). go off, configure those alternatives, and stay iconic πŸ‘‘βœ¨πŸ¦‹

πŸ“¦ where this page comes from