Stop apt from ignoring your local version pins
Package Management (Apt/Dnf/Pacman Internals)
Stop apt from ignoring your local version pins
🧩 The Challenge
You’ve definitely had that moment where you pin a package to a specific version in /etc/apt/preferences, only to watch apt upgrade it anyway because of some weird repository priority quirk. It makes you feel like you’re losing your mind staring at the output.
💡 The Fix
Check exactly why apt is picking the version it is by using the internal policy command. It tells you the truth about which repository is winning the priority battle.
apt-cache policy <package_name>
⚙️ Why It Works
The output shows you the priority score for every candidate version, letting you see exactly which file in /etc/apt/preferences or /etc/apt/sources.list is causing the override. It’s the only way to prove you aren’t crazy.
🚀 Pro-Tip: Look for the pin priority column; anything over 1000 means apt will downgrade to that version, which is usually how you accidentally blow up production.
Linux Tips & Tricks | © ngelinux.com | 11/7/2026
