Upgrade Debian 10 (Buster) to Debian 11 (Bullseye)

Debian releases a new stable version about every two years. The current version 11 (Bullseye) was released on 14.08.2021. Debian 10 (Buster) was released on 06.07.2019 and is expected to be updated until August 2022. After that, Debian 10 Buster is EOL ("End of Life"), but will still be supported via the LTS programme ("Long Term Support") until 2024.

Although 2024 is still some time away, it is worth switching to the new versions! It has become established practice for me to wait a few months after the release and then change over all systems step by step. Version 11.1 was released on 09.10.2021 - for me the starting signal to upgrade my own systems. In this article I document my procedure.

The use of screen or tmux is very helpful in case of a connection failure. Those who have not yet dealt with this more intensively should do so before upgrading.

Step 1 - Backup

Before starting the whole procedure, make sure that a current backup or snapshot of the system is available. Something can always go wrong during an upgrade - a backup is therefore indispensable!

Step 2 - Update system

Before the actual upgrade, the system should be up to date. The following command can be used to update Debian 10:

$ sudo apt update && sudo apt dist-upgrade

In the case of kernel updates, a reboot would also make sense. Otherwise, continue directly with step 3!

Step 3 - Update package sources

In the apt configuration files under /etc/apt/sources.list and in the directory /etc/apt/sources.list.d/ all references from buster to bullseye must be changed. This can be done manually, e.g. with nano or vim, or automatically with sed. buster/updates becomes bullseye-security, every other buster becomes bullseye.

$ sudo find /etc/apt/ -type f -name '*.list' -exec sudo sed -i 's/buster\/updates/bullseye-security/g' {} +

$ sudo find /etc/apt/ -type f -name '*.list' -exec sudo sed -i 's/buster/bullseye/g' {} +

The local package list can then be updated:

$ sudo apt update
[...]
1191 packages can be upgraded. Run 'apt list --upgradable' to see them.

Step 4 - Update system

Now the system can be updated using apt:

$ sudo apt full-upgrade

The list that appears is divided into 4 sections:

The following packages were automatically installed and are no longer required: Packages that were automatically installed and are no longer required after the upgrade. We will remove these later.

The following packages will be REMOVED: Packages that will be removed during the upgrade. Here it is worth taking a closer look and checking if new versions of the software have to be installed manually after the upgrade. In my case, for example, it was necessary to install the php7.4 packages manually.

The following NEW packages will be installed: Packages that will be reinstalled with the upgrade.

The following packages will be upgraded: Packages that will be upgraded with the upgrade.

After the upgrade, we reboot the system:

$ sudo reboot now

Step 5 - Check services

First, check whether all services have been started correctly again. In case of problems, it is worthwhile to read the changelogs of the specific applications in order to be able to make changes in the configuration files, for example. Usually, however, there are only a few problems.

Step 6 - Remove obsolete packages (optional)

Mit folgendem Befehl lassen sich nun alle veralteten Pakete (welche keine Funktion mehr auf dem System haben) entfernen.

$ sudo apt autoremove

Conclusion

The system is now updated to Debian 11.