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 pinning in preferences.d locks a package to one version range

Apt
~/tips/tip-apt-pinning-preferences-d

Pin: version 1.24.*

Tells apt which version of a package to prefer, and keeps it there.

Holding a package stops it once. A pin file says which version or release apt should prefer for good.

# /etc/apt/preferences.d/nginx
Package: nginx*
Pin: version 1.24.*
Pin-Priority: 1001

A priority above 1000 makes apt install that version even if it means a downgrade, and it stops upgrades to anything that does not match the pattern. Check the result with apt policy nginx, which shows the priority next to every candidate. The file name must only use letters, digits, underscores, hyphens and periods, and files with other extensions are ignored. Remove the file to go back to normal behaviour.

Further reading: apt_preferences 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