Upgrading Debian 10 to Debian 11

Upgrade Debian 10 to Debian 11

This article explains how to upgrade your Debian 10 system to Debian 11 via the command line, i.e. Debian Buster to Debian Bullseye. Before talking about the upgrade, let me remind you that since August 14, 2021, Debian 11 has been available for download after more than two years of development. Codenamed "Bullseye", it will be supported for five years and is the new stable release of Debian. Currently, Debian 11.3 has been available since March 26, 2022, and is a patched version of Debian 11.

To perform this upgrade operation, you must have superuser privileges, i.e. you must be logged in as root or as a user with sudo privileges.

Before you start, back up your data and, if it's a virtual machine, trigger a backup or snapshot so you can go back if you run into difficulties. Now it's time to get practical.

1. Update your current packages

Before you begin upgrading Debian 10 to Debian 11We recommend that you update all your currently installed packages to their latest versions. Generally speaking, the latest versions are compatible with the latest system version, in this case Debian.

Packages marked as pending (or locked, if you prefer) cannot be automatically installed, upgraded or removed. This can cause problems during the upgrade process. To check for locked packages, start by running the following command:

sudo apt-mark showhold

If the command returns one or more packets, this means that there are packets waiting. Each packet needs to be processed, so either delete it or make sure it won't disrupt the upgrade Debian 10 to Debian 11. To delete an affected package, remove the lock. Here's an example:

sudo apt-mark unhold PackageName

Update the package index and upgrade your packages by running these two commands:

sudo apt update
sudo apt upgrade

Next, run the commands below to perform a major upgrade of the installed packages and then remove some unnecessary packages:

sudo apt full-upgrade
sudo apt autoremove

2. Upgrade Debian 10 to Debian 11

Let's move on to the upgrade Debian 10 to Debian 11 itself. The first step is to reconfigure the file containing the package sources.

To do this, open the file /etc/apt/sources.list with your text editor (nano, vi, etc.) and update the various lines to target the new Debian version. However, we're going to use the Sed command instead. If you have other files under /etc/apt/sources.list.d, you'll need to update these files with the new sources as well.

For your information, the default /etc/apt/sources.list file looks like this:

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
deb http://deb.debian.org/debian bullseye-updates main
deb-src http://deb.debian.org/debian bullseye-updates main

To update it with the correct values via Sed, without even opening the file (although you can open it to check), run these three commands:

sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list
sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*.list
sudo sed -i 's#/debian-security bullseye/updates# bullseye-security#g' /etc/apt/sources.list

With new sources comes the need to update the package index:

sudo apt update

If there are any errors or warning messages related to an unofficial repository, please remove it from the file. Start the system upgrade by upgrading the installed packages.

sudo apt upgrade

During this upgrade, don't be surprised if questions arise. For example, to ask whether you want to keep an existing configuration file or retrieve the new version from the editor (or the person responsible for the package).

Read the information carefully to make the right decision. If you haven't made any changes to the file, it's best to type Y to retrieve the new version, otherwise, to keep the current configuration, type N.

This first stage of the upgrade may take some time, depending on the speed of your machine and your Internet connection.

When that's done, move on to the next step: the complete system upgrade.. An important step for installing the latest versions of packages and resolving dependency problems between packages of different versions. It complements the previous command.

sudo apt full-upgrade

Once you have done this, remove any unnecessary packages with the following command:

sudo apt autoremove

Restart the server and keep your fingers crossed! Your machine should now boot into Debian 11! 🙂

sudo systemctl reboot

3. Is the upgrade effective?

Following machine restart, how do I know if the upgrade from Debian 10 to Debian 11 is complete? Well, by executing the command below.

lsb_release -a

You can also use this command:

uname -r

Here's an example of output where you can clearly see that the upgrade has worked.

No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
Upgrading Debian 10 to Debian 11

Congratulations! You've just upgraded from Debian 10 to Debian 11 on your server! The procedure is the same whether it's a physical or virtual server, but remember to back it up in all cases.

Resources

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *