Differences between revisions 14 and 15
Revision 14 as of 2009-02-15 11:09:46
Size: 4664
Editor: PerOlofsson
Comment: explain about experimental pinning
Revision 15 as of 2009-03-16 03:31:01
Size: 4666
Editor: anonymous
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 7: Line 7:
 * [http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html Apt-Howto] (Section 3.10) and AptPinning.  * [[http://www.debian.org/doc/manuals/apt-howto/ch-apt-get.en.html|Apt-Howto]] (Section 3.10) and AptPinning.


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

Available Docs


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

  • Ignore packages that don't meet version criteria
  • Ignore packages lower versioned than current, unless their priority is > 1000

  • Install highest priority remaining package
  • In case of priority tie, take pinned package.
    • This step should probably be skipped if the pin doesn't match anything
  • In case of no pinned package, take highest version.

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:

  • All packages from a distribution called testing are pinned to 900
  • All packages from a distribution called unstable are pinned to 300
  • All other packages from Debian are pinned at -1 and thus never installed.

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:

  • Have both unstable and experimental in sources.list

    • In absence of explicit pinning, experimental will be automatically pinned to priority 1. This is because experimental's Release file contains NotAutomatic: yes.

  • Pin the wanted packages to a value x with 100<x<500:

     Package: dpatch
     Pin: release o=Debian,a=experimental
     Pin-Priority: 450
    • A value > 500 will always select a package from experimental, even preventing a higher numbered unstable package from being installed, and selecting "no package at all" ahead of all available packages if the distribution not containing that package is pinned higher.

    • Unfortunately, the Package field understands neither wildcards nor regular expressions. You need one pin stanza per package.
    • Pinning the package to 450 will probably not automatically update to the experimental package, but it will probably track the package in experimental as long as it stays higher-versioend than the one in unstable.


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
  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?


  • StephenHargrove, who probably did the initial version of this page (if ZugSchlus interpreted the revision history correctly)

  • ZugSchlus, who tried to add some explanations and more examples

    • with help from Adeodato Simó and Paul Hampson on debian-devel@l.d.o