Ubuntu update-alternatives (soft connection management), ubuntualternatives

Source: Internet
Author: User

Ubuntu update-alternatives (soft connection management), ubuntualternatives

Update-alternatives-manage soft connections/character links (symbolic links)

Command Format

Update-alternatives [options] command

Detailed description

Update-alternatives can be used to create, delete, repair, and soft connections. It can also display information about existing soft connections. All of these constitute the alternatives system ).

In many cases, we install different applications with the same or similar functions on the same operating system, such as different text editors on the same operating system. This gives users of this system more choices when editing texts. If users want to, they can choose any one of them. But what if the user does not specify which editor he wants to use? It is embarrassing for a program because it has no one to make a so-called "good" choice.

However, the emergence of the alternatives System In Debian solved this problem. A common name (generic name) in the file system is shared by files with interchangeable functions, the alternative system and system administrator jointly decide which file is specified by the shared name (that is, the alternative system cannot help users manage soft connections completely, after all, people-oriented ). For example, if the text editor ed (1) and nvi (1) are installed in a system and the alternative system scheme is assumed to share the name (/usr/bin/editor) by default, it is directed to/usr/bin/nvi. Then, the system administrator can abolish this designation and direct the shared name to/usr/bin/ed. Unless otherwise specified, otherwise, the option system will not change this setting.

In fact, the shared name does not directly point to the soft connection of the selected Program (command), but to a name in the alternative directory (alternatives directory. This name is also a soft connection, which directly points to the selected Program (command ). The purpose of this mechanism is to limit the changes made by the Administrator to the corresponding configuration file in the/etc directory: FHS can well provide the benefits of doing so.

Update-alternatives is called to update the information of the corresponding file in the alternative scheme when any file (Program/package) providing specific functions is installed, deleted, or changed. Update-alternatives are often called by the psstinst (configuration) or prerm (installation) script in the Debian package.

Multiple alternatives that are synchronized for better performance 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 correspond to the vi version specified by/usr/bin/vi (different versions of vi have their own man, what we need to do is to display the man page corresponding to the vi editor we are using ).

Each link group has two different modes: automatic mode and manual mode. A group can only be one of them at any given time. If a group is in automatic mode, when the package is installed or deleted, the alternative system determines whether or not to update the corresponding link (links ). If you are in manual mode, the alternative system retains the original administrator's choice and avoids link changes (unless a broken occurs ).

When the connection group is installed to the system for the first time, it is assigned the automatic mode. If the system administrator then changes the Mode settings, the group is automatically converted to the manual mode.

Each option has its own level (priority). When a link group is in automatic mode, its members will point to high-level options.

When the -- config option is used, update-alternatives lists the master link names of all link groups. The currently selected group is marked. You can change the link direction at the prompt, but this will change the mode to manual. If you want to reply to the automatic mode, you can use the -- auto option, or -- config to reselect the Group marked as automatic.

If you do not want to use the interaction mode provided by -- config, you can also use the -- set Option (more details are provided below ).

Different packages that provide the same file need to be synchronized. In other words, the use of update-alternatives works for the involved packages.

Terms

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

Generic name (or alternative link)

This is a name, such as/usr/bin/editor. It points to a series of packages with similar functions through alternatives system.

Alternative name

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

Alternative (or alternative path)

Files (programs) that can be stored in the file system specified by the soft connection ).

Alternatives directory

The default value is/etc/slternatives.

Administrative directory

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

Link group

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

Master link

The primary link that determines other related links in a link group.

Slave link

The soft connection controlled by the master link.

Command

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.