How to upgrade Debian 10 (Buster) to Debian 11 (Bullseye)

Introduction

Debian 11 is out for quite a while now. The new version comes with a ton of updated packages and five years of support. Some of you might still be on Debian 10 though. So, today I'll show you how to upgrade to the latest and greatest release of Debian. These instructions may also be used for upgrades from other Debian versions. You will then need to replace buster with the version you are currently using and bullseye with the newer version you want to upgrade to.

Upgrade procedure

Step 1: Update the system

Before upgrading to the next release of Debian, it is a good idea to upgrade the current packages to the latest version available.

$ sudo apt update
$ sudo apt upgrade
$ sudo apt full-upgrade
$ sudo apt --purge autoremove

and the upgrade process should start.
It is also worth installing these upgrades automatically and unattended. I've already written a guide on the subject.

Fig. 1 - Updating the system

After a successful upgrade, it is recommended that you reboot the system to load the new Linux kernel and get the services up and running with the updated binaries.

Step 2: Backup your system

Please make a backup of the system (at least of the data and the system configuration). Many cloud VM providers offer free snapshots of the system, that should be the least you do! Even though the upgrade normally goes smoothly, it is possible that something goes wrong and the system is unusable afterwards. Therefore, make a backup NOW!

Step 3: Update the sources.list file

Before we can update Debian to the latest version, we need to tell APT that we want to use the new package sources. Otherwise, the package manager will not know how to get the updated packages we need for Debian 11. You can view the default package sources of your current system by using the cat command to view the content of the file.

$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian buster main
deb-src http://deb.debian.org/debian buster main
 
deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main
 
# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian buster-updates main
deb-src http://deb.debian.org/debian buster-updates main

You may want to copy the current sources.list files to another location (for example, your home directory) as a backup.

$ cp -v /etc/apt/sources.list ~
$ cp -rv /etc/apt/sources.list.d/ ~

Now it is time to update the files accordingly. Open the /etc/apt/sources.list file with your favorite text editor and change all existing references from buster to bullseye. If you see keywords other than buster in this file (e.g. stretch (Debian 9), jessie (Debian 8), wheezy (Debian 7) or similar), please upgrade your system to the next version first until you are on Debian 10 (buster).

The Debian security repository has changed its "syntax", so we need to update it to allow APT to load the sources.

# Original
deb http://deb.debian.org/debian-security buster/updates main
# After our change
deb http://deb.debian.org/debian-security bullseye-security main

For reference, this is the sources.list file that I use on my systems and with which I've upgraded to Debian 11 successfully:

$ cat /etc/apt/sources.list
deb http://deb.debian.org/debian bullseye main
deb-src http://deb.debian.org/debian bullseye main
 
deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main
 
# bullseye-updates, previously known as 'volatile'
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

Now please update the contents of the files in the /etc/apt/sources.list.d/ directory as we did with the sources.list file. In case you don't know how to modify a repository in the directory for Debian 11, please refer to the documentation of the repository or look it up on the internet.

Step 4: System upgrade

After that, we need to update our package lists. Otherwise, our system will not know about the new Debian 11 packages we want to install.

$ sudo apt update

Now we want to upgrade our existing packages without installing any new packages (also called minimal system upgrade) before performing the full system upgrade. This helps avoid removing a large number of packages that we want to keep on our system.

$ sudo apt upgrade --without-new-pkgs

During the update process, questions may pop up about whether you want to replace or keep a configuration file, restart a service that has received an update (or a library it works with e.g. libc, libpam, libssl) You might also encounter a list of changes included in some updates. Skim the changes and get an idea of whether you need to manually change some configurations after the updates (for example, if you are running a heavily customized service) and finish the process by pressing q.

Step 5: Full Upgrade to Debian 11

Now we need to perform the full system upgrade to Debian 11, including all new package versions, new or changed dependencies and configurations. This upgrade will take longer because all packages that have received an update in Debian 11 will be updated on the system.

$ sudo apt full upgrade

You may be advised of changed configurations or services that need to be checked. If you have changed some files yourself, it is a good idea to point out the differences between the current and the new configuration and decide which version to install/keep.

Step 6: Complete the upgrade

It's now time to reboot the system.

$ sudo reboot

It may take some time for the system to boot up again. It is strongly recommended to have a console open for manual intervention (e.g. a VNC console).

When the system is running again, log back in and check that the new kernel is running and that the system reports that it is running Debian 11.

$ uname -r
5.10.0-11-amd64
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

If that looks good, check that all installed services are running and not reporting any problems or errors. If everything seems to be in order, we are done!

netcup.de