Ubuntu Update-alternatives Learning (soft connection management)

Source: Internet
Author: User

update-alternatives--Management soft Connect/Word linked (Symbolic links)

Command format

update-alternatives [Options] Command

Detailed description

Update-alternatives can be created, deleted, repaired, soft-connected, and can display information about existing soft links, all of which constitute the Debian alternative system (alternatives systems).

Many times we will install different applications with the same or similar features on the same operating system, such as a different text editor on the same operating system. This gives the user of this system more choice when editing text, and if the user wants them to be free to choose any one to use. But what if the user doesn't specify which editor he wants to use? It's awkward for the program because it doesn't have the same willingness to make a so-called "good" choice.

However, the advent of Debian's alternatives system solves this problem. A common name (generic name) in the file system is shared by those files that have the ability to swap, and the alternative system and system administrator decide which file is specified by the common name (i.e. the alternative system does not completely help the user to manage the soft connection, after all, people-oriented). For example, if the text editor Ed (1) and NVI (1) are installed in a system, and assuming that the alternate system scheme allows the common name (/usr/bin/editor) to point to/usr/bin/nvi by default, then the system administrator can revoke the designation and have the shared name point to/usr /bin/ed, the alternative system will not change this setting unless it is specifically necessary.

In fact, the common name is not a soft connection directly to the selected program (command), but rather a name in the alternative directory (alternatives directory). This name is also a soft connection, which is directly pointing to the selected program (command). The purpose of this mechanism is to restrict the changes made by the administrator to the corresponding configuration file in the/etc directory: FHS can give you a good idea of the benefits of doing so.

When any of the files (Programs/packages) that provide a particular feature are installed, deleted, or changed, Update-alternatives is called to update the information for the corresponding file in the alternative. Update-alternatives is often called by Psstinst (config) or prerm (installation) scripts in the Debian package.

Multiple alternatives that are synchronized for better functioning are called groups; for example, when multiple versions of the VI Editor are installed, the man page specified by/USR/SHARE/MAN/MAN1/VI.1 should be followed by the current/usr/bin/ VI specified version of the vi corresponds to (different versions of VI have their own man, we have to do is to man when the display of the man page and we are using the VI editor corresponding).

Each link group has two different modes: Auto mode and manual mode, and at any given time a group is and can only be one of these modes. If a group is in automatic mode, when the package is installed or deleted, the alternative system will decide for itself whether and how to update the corresponding link (links). If you are in manual mode, the alternative system retains the choices made by the original administrator and avoids changing the links (unless broken occurs).

The link group is assigned to automatic mode when it is first installed to the system, and the group is automatically converted to manual mode if the system administrator makes changes to the mode settings.

Alternatives have their own level (priority), and when a link group is in automatic mode, its members point to high-level alternatives.

When you use the--config option, update-alternatives lists the primary link names for all linked groups, and the currently selected group is marked with a * number. You can make changes to the link point at the prompt, but this changes the mode to manual. If you want to reply to Automatic mode, you can use the--auto option, or--config to re-select the group labeled Automatic.

If you do not want to use the interactive mode provided by--config, you can also use the--set option (more detailed below).

Different packages that provide the same files need to be synchronized, in other words, the use of update-alternatives is useful for the packages that are implicated.

Terms

Because the mechanism of update-alternatives is complex, some of the following terms can be helpful to understand.

Generic name (or alternative link)

This is a name, shaped like/usr/bin/editor, that points to a series of packages with similar functionality through the alternatives system.

Alternative Name

This refers to the name of all soft connections under the/etc/alternatives directory.

Alternative (or alternative path)

A file (program) that can be specified by a soft connection in the file system.

Alternatives Directory

The default is/etc/slternatives.

Administrative directory

The default is/var/lib/dpkg/alternatives, which contains the status information for the update-alternatives.

Link Group

A series of soft connections that have internal relationships that can be changed at the same time.

Master Link

A link group that determines the main link for other related links.

Slave link

A soft connection that is controlled by the primary link.

Command

Ubuntu Update-alternatives Learning (soft connection management)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.