distro-sync for Debian

Red Hat like systems have a feature called "distro-sync", or "distribution-synchronization". This will upgrade/downgrade all packages to the version that is provided by the current sources. Debian, and Ubuntu, and Debian-like systems, don't have this. But you can somewhat emulate this behavior by using the pinning feature of apt.

When you install/upgrade a package, apt evaluates the various versions it has in its database . You can see this with the apt policy command. Try it out for any package, bash for example: apt policy bash. If the priority of a package is high enough, apt will even downgrade. 1001 is usually enough.

We need to change the priority of our preferred version. To do that, we add a file to the /etc/apt/preferences.d/ directory, with the content:

Package: *
Pin-Priority: 1001

Instead of PUTYOURRELEASENAMEHERE, you should mention your favorite release name. The same one that is also used in the output of apt policy. After that, is it (mostly) a matter of doing an apt upgrade, and an apt full-upgrade. Mind you, if you're correcting a semi-broken state of your system, you might need to remove some packages and reinstall them later. It might be a good idea to keep track of the packages you remove by writing the important ones down. At least try to keep you graphical environment working, by making sure "gnome" is installed for example. You can do this easily by using tasksel.

This article is my 8th oldest. It is 242 words long