Installing packages from ‘testing’ on a ‘stable’ machine


It is nice to be able to run debian ‘stable’, yet still be able to
install the occasionally package from ‘testing’. This can be done by adding both distributions to /etc/apt/source.list and then configuring apt to get only ‘stable’ by default.

This should only be tried for packages without a lot of dependencies, unless you ‘pin’ (see below).

Configuring apt

To get only stable by default edit /etc/apt/apt.conf:
bc. APT::Default-Release “stable”;

An example /etc/apt/sources.list with both distributions:

  deb stable main non-free contrib
  deb stable/non-US main contrib non-free
  deb-src stable main non-free contrib
  deb-src stable/non-US main contrib 


  deb stable/updates main contrib non-free
  deb testing main non-free contrib
  deb testing/non-US main contrib non-free
  deb-src testing main non-free coĆ .wib
  deb-src testing/non-US main contrib non-free

Installing Testing Packages

With these settings, to install postfix-snap from ‘testing’, you would do this:
bc. > apt-get install postfix-snap/testing

If you are feeling dangerous, you can do this:

 > apt-get -t testing install postfix-snap

Note, however, that this will resolve all the dependencies of the package! This can be a very bad idea.

To install a package of a particular version:

 > apt-get install package-name=version

Upgrading Testing Packages

If you have a testing package installed and do an upgrade, only the stable packages will get upgraded. Here is a quick and dirty way to be able to upgrade your testing packages as well:

  > apt-get install apt-show-versions
  > apt-get install `apt-show-versions -u -b | grep testing`

This will ensure that you do not get more of the less-stable distribution than they had in mind.

Pinning Packages

note: i have not tested this!!!

When installing packages from testing on stable, it is a good idea to set a default ‘pin’ so that you can control which packages will get installed from testing.

If you don’t do this, then your testing packages might require a million other packages from testing, and you could end up upgrading your entire system to testing. Yikes!


   Package: *
     Pin: release a=stable

   Package: postfix-snap
     Pin: release a=testing