Search code examples
debianpackage-managersdpkg

What is the "package selection data" in Debian's package management system?


I'm learning Debian's package management system and have read Chapter 2. Debian package management. But I have difficulty in understanding the concept of "selection", or maybe "package selection". More specifically:

  • What exactly is a "package selection"?
  • What does a "package selection" select?
  • Under what circumstances do I need to care about a "package selection"?

For example, whenever I want to find whether I have a package installed on my system, I usually run dpkg --get-selections 'PACKAGE-NAME'. Frankly speaking, I don't know exactly why the option is called get-selections and why I should use it. I turned to dpkg manpage, but it doesn't explain further. The chapter above doesn't seem to explain, either.

While I'm reading the Debian reference, I see another tool called dselect which also helps manage the packages. I'm also curious why it is called "select", and this may be a hint to understanding the concept of "selection".

According to my current research, I have some guesses of what it is about:

  • The "selection" may have something to do with multiple versions of the same package. I can install all the versions on my system, but the "selection" specifies which version is the active one.
  • The "selection" may have something to do with alternative packages that serve the same purpose. For example, I may install vi, vim, and nvi on my system, and the "selection" specifies which one is the actively used one.

However, the understandings above don't look right because that seems to be solved by using the symbolic links.

Hope someone would explain it to me. Thanks for the help!


Solution

  • If you write dpkg --get-selections (this command is often included in crontab so that we backup the actual package installed on a machine), you get the list of all packages, installed, and deinstalled (but not purged).

    So the selection is one of the status of the package:

    • install: the package is installed
    • deinstall: the package is no more installed (but config file are keep, so the package is not like non installed (or purged) packages). The dpkg still keep track of config files.

    As far I know, you can tell dpkg also to install, hold, deinstall or purge (--set-selections)

    This is a sort of selection, so the name. There are other statuses (successfull installed, error on postinst, error on untar, ...).

    Note: Debian Reference Manual is a very old manual, grown "organically". Feel free to fill a bug (minor or wish), so that volunteers can improve it.