Debian: programs from stable, testing, unstable and even experimental without trauma

I originally wrote this in Italian but I think that it may be more useful translated into English

In daily use of computers it often happens that you need a stable base and at the same time use recent, very recent or even ‘beta/alpha/experimental’ versions of some specific programs.

Debian users are no less, indeed! It also apply to all its derivatives, starting from Ubuntu.

Matteo Galacci suggest (in an italian article) – like many others – to use Debian’s “pinning” capability.

In reality, if the need is to have ‘almost all’ stable programs, some more recent and a few ‘very recent’ it is possible to obtain this behavior by exploiting the basic algorithm of the Debian package manager apt. Consulting the man-pages that tells us how to set up our sources (man sources.list) we read:

The source list /etc/apt/sources.list and the files contained in /etc/apt/sources.list.d/ are designed to support any number of active sources and a variety of source media. The files list one source per line (one-line style) or contain multiline stanzas defining one or more sources per stanza (deb822 style), with the most preferred source listed first (in case a single version is available from more than one source). The information available from the configured sources is acquired by apt-get update (or by an equivalent command from another APT front-end).

The ‘trick’ is in the part in bold. Matteo first proposes testing, then unstable and finally stable. So apt will almost never choose stable releases. I use a /etc/apt/sources.list like this:

deb http://ftp.it.debian.org/debian/ stable main contrib non-free
# stable-updates, previously known as 'volatile'
deb http://ftp.it.debian.org/debian/ stable-updates main contrib non-free
# if something is not in stable look in testing
deb http://ftp.it.debian.org/debian/ testing main contrib non-free
# then search for it in unstable 
deb http://ftp.it.debian.org/debian/ unstable main contrib non-free
# as an extrema ration look in experimental
deb http://ftp.it.debian.org/debian/ experimental main contrib non-free

Putting stable first, and then testing, unstable and also experimental in this order

So when we don’t need particular versions, just ask for ‘apt install package‘ and the most stable version possible will be chosen: if it’s in stable, otherwise it will take the one in testing, therefore it will search into unstable and finally experimental.

Easy, fast, practical. And above all it works, and it works well. With this APT setup, I’ve been using the Radeon card drivers from experimental for years without any other programs being upgraded to experimental versions.

Then if we wanted a particular version just run ‘apt install package unstable‘ and the unstable one will be installed.

In the case of updates, APT will remember our choice and continue to update the ‘package’ from the source indicated by us. If over time the version we wanted should (as we all hope) enter testing and then stable, just re-launch ‘apt install package/stable‘ to go back to updating from stable.

If we then wanted to ‘go down’ in version just add an --allow-downgrade.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.