Apt-get and its irritating lack of easy selective upgrades

March 7, 2016

One of my many irritations with apt-get is that it doesn't easily allow you to only apply some of the pending updates. Sure, often you want to apply all of the updates (at least all of the unheld updates), but there are any number of cases where you want to be more selective. Sometimes you are in a rush and you want to apply only a few very urgent updates. Sometimes you want to apply updates in a specific order, updating some packages before others. Sometimes you want to apply most updates but temporarily exclude some that you consider low priority or disruptive.

With a package manager like yum (or now dnf) you can easily do either of these. If you just want to exclude some packages, you do that with '--exclude'; if you only want to upgrade some packages, you do that by supplying them as explicit arguments. And it's harmless to be a bit broad in your explicit arguments, because you're specifically only upgrading existing packages; you'll never install new ones out of nowhere.

apt-get does not support this usage as far as I can see. apt-get upgrade takes no package list and has no way of excluding some packages; it is an all or nothing operation, where the only way you have of being selective is to hold packages in advance in order to block their upgrades. In order to upgrade packages selectively, you must turn to 'apt-get install', probably with '--only-upgrade' so that you don't accidentally install new packages. And as far as I can tell this has no equivalent of yum's --exclude, so there's no easy way I can see of saying 'upgrade everything except the following packages'.

(apt-get install does at least support wildcards, or more exactly POSIX regular expressions. I don't know why they decided to use regular expressions instead of shell globbing, but it feels like a very Debian decision, especially the detail that it defaults to matching substrings.)

'apt-get install --only-upgrade PKG ...' solves about half of the problem (although clumsily) so I'm less disgruntled than I was at the start of writing this entry, but it's still not particularly great.

Written on 07 March 2016.
« Firefox addons seem unfortunately prone to memory leaks
Why it makes sense for true and false to ignore their arguments »

Page tools: View Source, Add Comment.
Login: Password:
Atom Syndication: Recent Comments.

Last modified: Mon Mar 7 01:14:06 2016
This dinky wiki is brought to you by the Insane Hackers Guild, Python sub-branch.