Wandering Thoughts archives


Mangling your distribution version in your Apt sources for fun and profit

Over on Twitter I admitted to something:

I just trolled myself by installing an apt sources.list for 'focal' (Ubuntu 20.04) on my Ubuntu 22.04 beta scratch install ('jammy'). I wish apt had symbolic names for 'the current distro release'.

Apt is the Debian package management system (and also used by Ubuntu and other Debian-derived distributions), and so of course it has a system for configuring where it gets packages from ('sources' in the jargon). Commonly, entries look like this:

deb http://ca.archive.ubuntu.com/ubuntu focal main restricted

(For information on the format of these lines, see here and here.)

Much of this is obvious; the bit that may not be is that 'focal' is the code name for Ubuntu 20.04. Every sources.list line needs to say what distribution release it's for, and it had better be right, which is to say it had better match the distribution release you're actually running.

Normal people don't wind up with sources.list entries for the wrong distribution. How I did it is that we have an Ubuntu install environment, and one thing it does is it stuffs a pre-made, localized sources.list onto the newly installed system. When I started building a version of our install environment for Ubuntu 22.04 (using the beta release), I copied all of our 20.04 environment over and started changing things necessary to make it work (such as the ISO base image). However, I forgot that we had an embedded sources.list and the embedded sources.list had the Ubuntu release name in it. Since I started from our properly working 20.04 version, my sources.list said 'focal' instead of 'jammy' and things started going wrong.

The actual failures were surprisingly subtle. I (or our scripts) would try to 'apt-get install' some additional package and it would error out reporting that there were unresolvable conflicts in version requirements between the new package and already installed packages. At first I muttered to myself about packaging problems in a beta release, but eventually I realized that things couldn't be this badly broken and the penny dropped. I might have noticed faster with a different set of package conflicts; I was unlucky enough that the ones I started with didn't have the Ubuntu version in their package version, so it wasn't obvious that I was getting the wrong Ubuntu version's packages.

(Some Ubuntu packages have version numbers that look like '3.36.1-2ubuntu0.20.04.2'; others just have ones like '2.13.3-7ubuntu5.1' or even '5.05-1'. If you're on 22.04 beta and you see that one of the packages having a conflict has '20.04' in the version number, you have a much higher chance of immediately realizing roughly what the problem is.)

PS: If I'm sensible I will make notes about all of the surprising bits of our install environment that need to be updated for a new Ubuntu version, now that I'm going through the process and stubbing my toe on all sorts of bits and pieces.

linux/AptSourcesManglingEffects written at 23:30:09; Add Comment

Page tools: See As Normal.
Login: Password:
Atom Syndication: Recent Pages, Recent Comments.

This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.