• Aucun résultat trouvé

dpkg configuration

Dans le document SYSTEM DEBIAN (Page 159-163)

The Debian package management system

5.3 Dealing with packages: dpkg

5.3.8 dpkg configuration

dpkg reads its default options from/etc/dpkg/dpkg.cfg, as well as˜/.dpkg.cfg, which takes precedence. The contents of the file are trivial and consist merely of the literal command line options you need as defaults for every invocation ofdpkg, without the leading dashes. Thus, the following is a good way to ensure your sanity, should it ever come down to it:

˜# echo refuse-downgrade >> /etc/dpkg/dpkg.cfg

˜# dpkg --install /var/cache/apt/archives/bash_2.05b-24_i386.deb Will not downgrade bash from version 3.0-10 to 2.05b-24, skipping.

5.3.9 dselect

If you have some previous experience of Debian, you will probably knowdselect.

To quote its maintainer: “dselect is the venerable user interface to the Debian package management system and archive. It’s certainly one of the most uniquely identifiable components of a Debian system.”

dselectis a user interface todpkgthat supports interactive package selection, and automatic acquisition of packages from various sources, such as CD-ROMs, FTP

sites.dselectcan also useAPT(see chapter 5.4) to acquire and install packages, and can thus also fetch DEB files from any source supported byAPT(see chapter 5.4.1).

The programme does not, however, make any other use ofAPT’s functionality.

dselectsports its own dependency resolution mechanism. When a package is se-lected for installation, dselectautomatically adds its dependencies to the set of packages to install. In the case of ambiguity (if two or more packages can satisfy a single dependency, for example),dselectpresents the user with a resolution screen in which a choice can be made among the possibilities.

Independently ofAPT,dselectkeeps its own list of available software in/var/lib/

available. For dselect to be useful, this list has to be regularly updated, which can also be done at the command line, wherePackagesis the package index file downloaded from a Debian mirror or another source of Debian packages.

˜$ dpkg --merge-avail Packages

Updating available packages info, using Packages.

Information about 17877 package(s) was updated.

Figure 5.1:

The six steps of dselect

On launching,dselectpresents the user with a menu comprising six steps (or seven, depending on whether quitting is a step), depicted in figure 5.1. These steps are designed to be executed in succession and mostly relate to the individual calls to dpkg:

0. Access

In addition toAPT, which has become thedselectstandard access method since its inception,dselectcan also fetch packages from CD-ROM, via Net-work File System (NFS), from an unmounted or mounted filesystem, or from a floppy.

1. Update

The option causesdselect to retrieve the list of packages provided by the

access media chosen in step 0 and merges them into a single listing with dpkg --merge-avail.

2. Select

Behind this item hides the interface shown in figure 5.2. dselectpresents the packages it knows about according to various sort criteria and allows for the modification of the requested status of the packages (e.g. installing, or putting a package on hold).

Figure 5.2:

The package selection screen provided by dselect

3. Install

This step causesdselect to fetch all DEB files whose installation the user requested in the selection phase from the respective source media, and con-sequently to unpack all packages. It also automatically configures newly installed packages and removes those marked for deinstallation.

4. Config

Packages can be explicitly configured with this option, which the install calls automatically. It is therefore seldom used. The command executed for the configuration isdpkg --configure --pending.

5. Remove

If a user only wants to remove packages marked for deinstallation but post-pone any pending installations, this menu option should be chosen rather thanInstall. It is, however, executed automatically as part of an installa-tion. The command executed when selecting this option isdpkg --remove --pending.

The main interaction with the programme happens through the selection interface.

Here, you can scroll the list of packages and select packages for installation, dein-stallation, and purging, by pressing the[+](plus),[-](minus), and[_](underscore) keys respectively. A regular expression search over the package names is accessible with the[/]key. The package selection can be confirmed by hitting[enter], and changes can always be reverted with the[R]key.

When you change a package’s requested state (e.g.select it for installation),dselect checks whether the request can be honoured without rendering the system incon-sistent. If the request would introduce an inconsistency,dselectpresents you with a dependency resolution screen, and a suggestion on how to restore consistency.

You are free to accept the suggestion with the[enter]key, or to first make any changes, such as using a different package to satisfy a dependency than suggested.

If the selection you make in the resolution screen does not correspond to a consis-tent state (e.g.a conflict exists, or a dependency is not met),dselectopens a new resolution screen to resolve the new conflict.

The resolution screen can be quite a daunting experience to the new user, who may have a hard time returning to the package selection screen asdselectkeeps displaying one resolution screen after another. Keep in mind that the selection of packages you make must be internally consistent. Here,dselect’s dependency on dpkgclearly shows: unless you propose a selection that satisfies all dependencies and introduces no conflicts,dselectwill not accept it just likedpkgwould prevent the installation of an offending package. In particular, if you select an alternative package to satisfy a dependency, you must undodselect’s suggestion or the two packages may conflict. The[D]key can be used to erase all suggestions made by the user. The[U]key tellsdselectto revert all changes since the last suggestion (effectively making the suggestion again). Finally, it is always possible to restore the selection state before the unresolved dependencies or conflicts appeared by pressing the[R]key.

After making any changes (or not, if you are happy with the suggested solution), the[enter]key will take you back to the package selection window, or take you right back into the dependency resolution screen if inconsistencies persist. Re-member thatdselectis not capable of resolving these inconsistencies automati-cally, it can only make suggestions. It is possible to return to the main package selection without resolving dependencies and conflicts by using the[Q]key. When another inconsistency is found, the resolution screen will simply merge suggestions and alternatives for both inconsistencies into one list, which may be somewhat confusing.

Ifdselectis told to enact a selection that contains inconsistencies, it will skip over any packages with unresolved dependencies or conflicts and put these packages on hold. It is not possible to introduce inconsistencies into the system withdselect thanks to the underlyingdpkg.

While many users swear by dselect, my suggestion is to replace it in favour of aptitudeor another interface toAPT(see chapter 5.4.11, chapter 5.4.12, and chap-ter 6.10). Being based onAPT,aptitudecan resolve conflicts automatically to hon-our the user’s request; it does not impose a sequence of steps on the user: you can mark packages for installation and deinstallation as required and deal with broken packages individually, and whenever you desire. On the other hand, if this is too much trouble,aptitudewill find a solution for you.

Dans le document SYSTEM DEBIAN (Page 159-163)