Sometimes you need a package to stay at a specific version — a critical dependency that a newer version broke, or compliance requirements around a validated software version. APT pinning gives you that control.
Package: nginx Pin: version 1.24.0* Pin-Priority: 1001
# Hold a package at its currently installed version - simpler than pinning sudo apt-mark hold nginx # apt upgrade will now skip nginx entirely sudo apt upgrade # Check what's currently held apt-mark showhold # Release the hold when you're ready to allow updates again sudo apt-mark unhold nginx
Pinning vs Holding
apt-mark hold is the simpler tool for “don’t touch this package at all” — full pinning via /etc/apt/preferences.d is more powerful, letting you pin to a specific version pattern or even prioritize one repository’s version of a package over another’s, useful when mixing multiple APT sources.