Debian Sid: Mastering APT Pinning
If you're running Debian Sid (Unstable), you know the thrill of apt-get dist-upgrade breaking your X server. But sometimes you want the latest GNOME while keeping your core system on Testing or Stable. This is where APT pinning comes in.
The Preferences File
The magic happens in /etc/apt/preferences. By assigning priorities to different releases, you can control exactly where your packages come from.
Package: *
Pin: release a=testing
Pin-Priority: 900
Package: *
Pin: release a=unstable
Pin-Priority: 800
In this setup, APT will prefer Testing. If a package exists in both, the one from Testing gets installed.
Pinning a Specific Package
Say you absolutely need the latest kernel from Unstable, but nothing else.
Package: linux-image-2.4.20-k7
Pin: release a=unstable
Pin-Priority: 1001
A priority over 1000 means "install this even if it requires a downgrade." Use this with extreme caution.
Tracking Dependencies
The real trick is ensuring your dependencies don't spiral out of control. Always use the -t flag to see what's about to happen:
# apt-get install -t unstable libc6
This tells APT to treat Unstable as the target release for this specific command. If you're not careful, you'll end up with a Frankendebian that's impossible to maintain. But hey, that's the price of having the newest bits, right?
Aunimeda provides DevOps engineering and infrastructure services - CI/CD pipelines, containerization, cloud deployments, and monitoring setups.
Contact us to discuss your infrastructure needs. See also: DevOps Services, Custom Software Development