Note: Before you consider 'pinning', you might want to check apt-get.org and backports.org to see if the package you want has been backported to your release.

Pinning allows you to run certain packages from one version (stable, testing, unstable) without the necessity of upgrading your entire system. However, pulling in packages from "later" distributions are prone to pull in libraries as well, which might have you end up with a system that has the disadvantages of stable (old software), the disadvantages of unstable/testing (security support not as good as stable, bugs) without the advantages of either.

At its most basic level, pinning involves two files, /etc/apt/sources.list and /etc/apt/preferences.

An additional role is played by the target release, which can be set in apt.conf and via the apt command line.

/etc/apt/sources.list

 # official debian sites
 #### testing  #########
 deb http://http.us.debian.org/debian testing main contrib non-free
 deb http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free

 #### unstable #########
 deb http://ftp.us.debian.org/debian unstable main non-free contrib
 deb http://non-us.debian.org/debian-non-US unstable/non-US main contrib non-free

In this example, we're pulling from testing and unstable. You could, of course, modify this to pull from stable as well.

/etc/apt/preferences

The 'preferences' file is where the actual pinning takes place. Here's an example:

 Package: *
 Pin: release a=testing
 Pin-Priority: 900

 Package: *
 Pin: release a=unstable
 Pin-Priority: 800

Package defaults to any, as specified by the asterisk. Pin specifies the release (testing and unstable). Pin-Priority specifies the priority level. 'apt-get' defaults to something along the lines of "highest package version wins". The above restructures this priority so that packages in testing are given a higher priority.

You should also refer to the apt_preferences(5) manpage.

Installing from unstable

Let's assume that we're running testing and we want to try enlightenment from unstable. There are basically two methods for installing:

 # apt-get install enlightenment/unstable
 # apt-get -t unstable install enlightenment

The first will not attempt to upgrade any packages on your system, so if specific dependencies are not met, the install will fail. The second method will attempt to install/upgrade any dependencies. Of course, given the above example, 'apt-get' will ask you before proceeding.

References

External links:


(Integrate, remove, move, whatever. Just trying to offer another choice.)

Personally, I found the common configuration of a higher priority Testing pin and a lower priority Unstable pin to be problematic. At times, testing packages will depend upon other packages which are not currently in testing (perhaps representing a small glitch in testing) which causes packages to be automatically pulled in from unstable. In the period of testing prior to stabilization for the Woody release, this caused me to end up with over 100 unstable packages installed without even realizing it.

As a a result, I use a more conservative "only if I say so" approach to a mixed distribution, with a Pin file like this:

  Package: *
  Pin: release a=testing
  Pin-Priority: 900

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

Thus all debian packages are defaulted to priority -10, while testing receives a 900 point bonus. This invokes the behaviors:

From apt_preferences(5)

  500 < P <=990 :
        causes a version to be installed unless there is a version 
        available belonging to the target release or the installed 
        version is more recent
  [...]
  P < 0 :
        prevents the version from being installed

Note that a priority above 1000 will allow even downgrades no matter the version of the prioritary package. This means that you can use priority 1001 for a stable source if you want to downgrade to the stable versions of the packages you have installed (let's say from testing) on the system.

Installing packages with apt-get install packagename/unstable and apt-get install -t unstable packagename will both still work, but unstable packages will only be installed by these commands.

-- JoshuaRodman

AptPinning (last edited 2007-04-15 05:34:38 by TedPercival)