Step-by-Step Tutorial: Upgrading from Debian 11 to Debian 12

You could say that Debian 12 is a poetry of stability and quality. This release has only been out for a short time, but it is very well done and speaks of the work behind it. But it’s also fair to say that Debian 11 has been a good release, and that’s why so many people use it. Now, how to get Debian 12? Well, one way is upgrading Debian 11 to Debian 12. Today you will learn how to do it.

Debian 12 came on strong with an interesting kernel version and better handling of proprietary drivers. Therefore, it is normal that you wonder how to get it. The first way is known, and that is to do a clean install; the other is to upgrade from Debian 11.

Upgrading from a previous version has the great advantage that you should not lose your data and can continue with the system as you left it; on the other hand, some configurations may not be fully enjoyed and there is always a chance of failure.

However, don’t give it too much thought because Debian has always been known for being a stable distribution and takes great care in its upgrade process.

Avoid surprises: Perform a backup

Before doing any major system upgrade, the best thing to do is to make a backup of your main data.

To achieve this, you can use various tools such as TimeShift, or a more terminal-oriented solution such as Borg, which is very fast in operation. Or any backup application you use.

This backup is important that you keep it off the computer where you will perform the upgrade. Again, if something bad happens, at least your data will be safe.

Preparing Debian 11 for installation

Debian takes great care in the upgrade process so that the chance of failures is low. However, the effectiveness is increased if you meet a few preconditions

  • Remove as many packages or applications that you are not using as possible. This tip will not only result in fewer packages being downloaded, improving processing times, but also in less chance of failure.
  • Do not use third-party repositories, I consider this step more crucial than the previous one. Third-party repositories are essential for getting recent versions of needed applications, or installing applications that are not in the Debian repositories. However, abusing it could cause problems in an upgrade of this level.
  • Upgrade the system. If you do this periodically, you may not have much to upgrade. You should always do this to have a secure and stable system.

One last detail is that if you have a graphical environment such as GNOME or Cinnamon, it is a good idea to disable the plugins you have. Keep in mind that recent versions of them will be installed and there could be incompatibilities.

Upgrading Debian 11 to Debian 12

1.- Upgrading Debian 11 before changing to Debian 12

The first step to complete this tutorial is to upgrade the Debian 11 packages to their latest version. This step is vital to start the process of upgrading to Debian 12 with a good skin.

So, open a terminal or via SSH access a Debian 11 console and completely upgrade the system

sudo apt update
sudo apt upgrade
sudo apt full-upgrade

You must also remove here those packages that are no longer considered necessary by the system because they are orphaned dependencies.

sudo apt --purge autoremove

It is a good idea to reboot the system in case an upgrade is required. Better to be certain.

sudo reboot

Once the system boots, you will need to keep an eye out for packages with a status of hold This status prevents them from being updated via APT. Of course, you need to eradicate this.

First check what these packages are

sudo apt-mark showhold | less

Then, remove the showhold for the normal one

sudo apt-mark unhold [package]

This is what you should do with all packages that have the hold status.

2.- Change the Debian 11 repositories

The Debian 11 system repositories point to the Debian 11 development branch, as it is obvious. However, it is necessary to modify these repositories to match Debian 12.

So, change the repositories from Debian 11 to Debian 12. First, backup to current file.

sudo cp -v /etc/apt/sources.list [path/to/backup/]

To change the repositories, just replace bullseye with bookworm in each of the entries you have. In addition to this, you have to add the new repository for the drivers.

If you want to make the change via terminal, you can run

sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list

And then add the firmware entry. You can use nano or any text editor you prefer. The repositories should look more or less like this.

deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware

3.- Upgrading Debian 11 to Debian 12

It is now time to start the upgrade. Refresh APT to apply the repositories changes.

sudo apt update

Now proceed to upgrade

sudo apt full-upgrade
Packages for Debian 12
Packages for Debian 12

This will start the whole process of downloading and installing packages. Depending on your internet connection and installed packages, it may take a while to download.

It is likely that during the process you will be shown some screens asking for some confirmations. For example, one that will come up is whether you allow the system to restart services without prompting. Choose YES to accelerate the process.

You will probably also see a screen like this

Upgrade from Debian 11 to Debian 12 without restarting the system services
Upgrade from Debian 11 to Debian 12 without restarting the system services

Where you will be asked if the new, updated package configurations should replace the existing ones. For security and stability, I recommend that you leave them with the current version.

Configuring the config files for the apps during the upgrading to Debian 12
Configuring the config files for the apps during the upgrading to Debian 12

Continue the entire process until you finish the configuration and installation of each package.

In the end, you will have to reboot the system again

sudo reboot

4.- Testing Debian 12 on your computer

Now, if everything went well, you should have Debian 12 installed and ready for battle.

You can check this by opening a terminal and running

cat /etc/os-release

Sample output

Upgrade completed - Debian 12 is alive
Upgrade completed – Debian 12 is alive

As you can see, Debian 12 is running smoothly.

Conclusion

Upgrading from Debian 11 to Debian 12 is fairly straightforward, but it is a process that has to be done carefully to avoid problems. Now that you know how to do it, you can give it a try.

I hope you liked this post and can share it with all your friends.

Leave a Comment

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

Scroll to Top