Package Management (Apt/Dnf/Pacman Internals)
Find out which repo actually brought in that weird dependency
đź§© The Challenge
Dealing with a package that suddenly pulled in a bunch of garbage from a random third-party repo is a total nightmare. You’re staring at your package list trying to figure out which repository is the culprit, and apt-cache just isn’t giving you the clear answer you need.
đź’ˇ The Fix
Use the apt-cache policy command specifically on the package name to see the priority and origin of every available version. It saves you from digging through sources.list files by hand.
apt-cache policy package_name
⚙️ Why It Works
This utility inspects the internal state of the APT cache to map specific version strings directly to their source files and origin pinning. You’ll see exactly which repository is providing that version, including those pesky low-priority mirrors you forgot you enabled.
🚀 Pro-Tip: Pipe the output into grep -A to quickly spot the origin if you have a massive list of repositories.
Linux Tips & Tricks | © ngelinux.com | 11/21/2026
