brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: apt list '~o' finds installed packages that no repository offers anymore

Apt
~/tips/tip-apt-list-obsolete-packages

apt list '~o'

Lists packages that no longer exist in any configured repository, so they get no updates.

Packages from a removed PPA, a release upgrade or a hand-installed .deb stay on your system without getting updates. apt has a search pattern that finds exactly those.

Use the ~o pattern, short for ?obsolete:

sudo apt update
apt list '~o'
apt list '~i ~o'

The result shows each package with [installed,local]. That means it is installed but not available from any repository in your sources. After a release upgrade, these are often old libraries that the new release replaced.

Quote the pattern, since ~ means something to your shell. The second line adds ~i for installed to make that explicit; patterns written next to each other must all match.

I think this list is worth going through now and then. A library left over from the previous release is usually safe to remove, but check first with apt -s remove that nothing you need depends on it. A tool you installed from a vendor’s .deb is fine to keep, but now you know updates for it are your job.

Run apt update first, or the list is wrong. On a system with empty or broken package lists every package looks obsolete, because apt knows of no repository at all. If your list suddenly holds everything, that’s the reason, not a broken system.

Further reading: apt-patterns(7) manual page, apt(8) manual page

More Apt tips sudo apt-mark minimize-manual apt list '~c' grep -E ' (install|upgrade|remove) ' /var/log/dpkg.log | tail -o Dpkg::Options::="–force-confold" upgrade sudo apt-get -d -y full-upgrade All Apt tips (42) All topics

Link