AptPreferences

/etc/apt/preferences is a file in /etc/apt, the ?AptDirectory.

Available Docs

Disclaimer

This page has been written by ZugSchlus, who not even remotely grasps the concept of pinning. So, please take the words "probably", "needs to be verified" and similiar wordings literally, and document your findings (may they be "this page is right" or "this page is wrong", optionally "this page is wrong because") here.

Description of Package Selection Process

TODO: This needs to be verified

Examples of /etc/apt/preferences file

Example 1

 Package: *
 Pin: release o=Debian,a=testing
 Pin-Priority: 900

 Package: *
 Pin: release o=Debian,a=unstable
 Pin-Priority: 300

 Package: *
 Pin: release o=Debian
 Pin-Priority: -1

Missing: Documentation what this preferences file does.

ZugSchlus tries to explain:

Problem: This pin behaves differently depending on which target release is set in other parts of apt configuration. Hence, this example cannot really be documented without adding more information. A non-pinned package being part of the target release has default priority 990, while other non-pinned packages have a default priority of 500.

Example 2

Objective: On an unstable system, pull dpatch from experimental.

A possible (and not completely correct) solution:

Debugging

apt-cache policy package gives information about the selection process. Unfortunately, it is not widely known what the output means. The following is a try to interpret:

 $ apt-cache policy exim4-daemon-light
 exim4-daemon-light
  Installed: 4.50-1
  Candidate: 4.50-1
  Package Pin: (not found)
  Version Table:
      4.50-4 555
        500 http://mirror sid/main Packages
  *** 4.50-1 555
        100 /var/lib/dpkg/status
      4.44-2 555
        500 http://mirror sarge/main Packages

The priority of each version/location is the number at the left of it. In this case, 500, 100, and 500. It is unclear what the number at the right of the version number means. Some people believe that it is just the last period that was specified for this package in /etc/apt/preferences for that package, while others said it is the actual pin priority being placed on the package.

TODO: This section was written after taking a lot of more or less educated guesses. Would somebody with real knowledge of apt please verify?

Credits