{ "id": "package-management", "title": "Package Management & Version Pinning", "category": "packages", "tags": ["apt", "pacman", "packages", "pinning", "rollback", "IgnorePkg"], "updated": "2026-01-08", "summary": "Installing, rolling back, and pinning packages on Debian and Arch Linux.", "sections": [ { "heading": "Debian / Ubuntu (apt)", "body": "
Most commands need root.
", "code": "apt update # refresh package list\napt install nginx # install\napt remove nginx # remove (keep config)\napt purge nginx # remove + delete config\napt list --installed # list installed packages\napt show nginx # info about a package\ndpkg -l | grep nginx # alternative listing" }, { "heading": "Listing Available Versions (Debian)", "body": "", "code": "apt-cache policy nginx\n# Shows installed version, candidate version, and all available versions by priority" }, { "heading": "Installing a Specific Version (Debian)", "body": "", "code": "apt install nginx=1.22.1-9\n# Use apt-cache policy to find the exact version string first" }, { "heading": "Pinning a Package (Debian)", "body": "Pinning prevents apt from upgrading a specific package. Create or edit /etc/apt/preferences.d/:
Arch keeps a package cache in /var/cache/pacman/pkg/. If the current package broke something:
After rolling back, prevent the package from upgrading on the next pacman -Syu:
Pinning is a stop-gap, not a solution. Document why you pinned it and set a reminder to revisit. A pinned package stops receiving security updates. If the upstream bug is fixed in a newer minor version, upgrade to that instead of staying pinned indefinitely.
" } ] }