This insight came to me while working on improving Entropy Linux to prevent it from breaking after a full system upgrade or encountering major issues when installing packages with Debian testing repositories enabled. During this process, I discovered two critical configuration files for APT that can drastically improve system stability:
/etc/apt/preferences
/etc/apt/preferences.d/debian-pinning
With these configurations properly set, APT transforms from a system prone to sudden failure into a robust package manager capable of handling multiple repository types (e.g., stable, testing, unstable, MX) simultaneously. It mitigates risks such as conflicting package versions or breaking crucial components like glibc6 during a full upgrade.
This improvement isn't hypothetical—I’ve experienced system-breaking updates on MX Linux and other distributions when attempting a simple apt update && apt upgrade. Such issues were especially frequent when a significant number of packages needed upgrading due to the lack of recent ISOs with updated packages.
Since implementing these configurations for Entropy, I’ve conducted numerous full upgrades with testing repositories enabled at all times. Additionally, I can now seamlessly specify which repository to use for individual packages using the -t flag. For example: sudo apt install -t testing <package>
This allows me to install newer versions from testing without hassle or risk. The difference is remarkable, and it’s a change I believe could benefit many others.
> /etc/apt/preferences
Code: Select all
# High priority for Debian Stable (Bookworm)
Package: *
Pin: release a=bookworm
Pin-Priority: 1001
# Security updates for Stable (Bookworm) with the same high priority
Package: *
Pin: release n=bookworm-security
Pin-Priority: 1001
# Medium priority for Debian Testing (Trixie)
Package: *
Pin: release a=trixie
Pin-Priority: 750
# Low priority for Debian Testing (to prevent auto-installation)
Package: *
Pin: release a=testing
Pin-Priority: 50
# Very low priority for Debian Unstable (Sid)
Package: *
Pin: release a=unstable
Pin-Priority: 1
# Extremely low priority for Debian Experimental
Package: *
Pin: release a=experimental
Pin-Priority: -1
# Medium priority for Debian Backports (Bookworm-Backports)
Package: *
Pin: release a=bookworm-backports
Pin-Priority: 500
# High priority for MX Linux Repositories (Main)
Package: *
Pin: origin nl.mxrepo.com
Pin-Priority: 1002
> /etc/apt/preferences.d/debian-pinning
Code: Select all
# High priority for Debian Stable (Bookworm)
Package: *
Pin: release o=Debian, a=bookworm
Pin-Priority: 1001
# High priority for Debian Stable Updates (Bookworm Updates)
Package: *
Pin: release o=Debian, a=bookworm-updates
Pin-Priority: 1001
# High priority for Debian Stable Security Updates (Bookworm Security)
Package: *
Pin: release o=Debian, n=bookworm-security
Pin-Priority: 1001
# Medium priority for Debian Testing (Trixie)
Package: *
Pin: release o=Debian, a=trixie
Pin-Priority: 750
# Low priority for Debian Testing (general)
Package: *
Pin: release o=Debian, a=testing
Pin-Priority: 400
# Very low priority for Debian Unstable (Sid)
Package: *
Pin: release o=Debian, a=unstable
Pin-Priority: 100
# Extremely low priority for Debian Experimental
Package: *
Pin: release o=Debian, a=experimental
Pin-Priority: 1
# Medium priority for Debian Backports (Bookworm Backports)
Package: *
Pin: release o=Debian, a=bookworm-backports
Pin-Priority: 500
# High priority for MX Linux Repositories (Main)
Package: *
Pin: origin nl.mxrepo.com
Pin-Priority: 1002
It’s reasonable to assume that most users are sufficiently advanced while maintaining the principle of user responsibility for their systems. Common counterarguments, such as "it only happens if you mess with it," or "testing repositories are inherently unstable," are familiar refrains from staunch advocates of the traditional "vanilla" Debian approach.
In practice, however, using testing and unstable repositories while installing packages from these sources has significantly improved the stability of APT in my system. It has made Entropy Linux more resilient to issues than Debian, MX Linux, or any other Debian-based distro I’ve encountered. Astonishingly, less than 2 KB of carefully considered configuration can address one of Debian’s most significant issue and protect users from learning painful lessons the hard way.
This approach benefits everyone, particularly less experienced users who are prone to experimenting with APT—whether by attempting to install newer packages, running outdated or unverified commands from the internet, or inadvertently breaking their system. These scenarios are common and will continue to happen.
So, why not include these by default?
