Multiple sourcing in debian

Multiple sourcing in debian

This is more a note for myself in case I need to do it again some time. You can use one specific version of debian, and add occasionally packages from another one. This might be very handy in case you are using the testing repository, because sometimes a package dependency breaks and the best way to solve it is to install the missing package from unstable.

Keep in mind before trying this that debian versions are really made for what their name suggests, and if you want a system without problems, just stick to the stable version and don't try anything funny. On the other hand, if you are comfortable with linux and the debian packaging system, I find the testing version an excellent choice. Occasionally a package dependency breaks (usually bugs in the unstable version prevents a package to enter testing), and the package and its dependents get kept back by apt, so you must be very careful using apt-get dist-upgrade.

If you can't wait for the bugs to be fixed and the package to land in testing, it is quite easy to add exceptionally some packages from other version. First, add the desired repository to your /etc/apt/sources.list file:

deb http://ftp.br.debian.org/debian unstable main contrib non-freedeb-src http://ftp.br.debian.org/debian unstable main contrib non-free

Then, either add this to your /etc/apt/apt.conf.d/00defaultrelease file (create if necessary):

APT::Default-Release "testing";

But this will simply mark the testing repository with higher prioritary, which means if a package is temporarily unavailable in testing, the unstalbe package will be installed, either add this to your /etc/apt/preferences.d/00Default (create if necessary):

Package: *Pin: release a=testingPin-Priority: 500Package: *Pin: release o=DebianPin-Priority: -10

This will give to the testing release a priority of 500 (the normal priority for your main repo), and any other official debian repository a priority of -10, which means: NEVER install from there.

Then, to force-install a package from unstable, do:

apt-get install packagename/unstable

But be careful when that package pushes a lot of dependencies, because you'll begin to mix much different versions and it can give you headaches later. Better to keep this for emergencies, and with safe packages (that you know well, and that have few or no dependencies).