Quick Way to Upgrade Debian 11 to Debian 12

|
Last Updated:
|
|

Are you looking for a quick way to upgrade Debian 11 to Debian 12? Look no further, this guide will take you through all the steps for upgrading Debian 11 to Debian 12. Debian 12, codenamed “Bookworm”, has just been released! Read more about this new release on the release news page.

Upgrading Debian 11 to Debian 12

This guide applies to upgrade of both Debian 11 desktop and server versions to Debian 12.

Backup your Debian 11 System Data

Well, it is always a good idea to backup any data, not just your Debian 11 data when you are about to upgrade it to Debian 12. Backup will always save you just in case something happens during upgrade that may cause system failure. It ensure you have a copy of your data which you can always access and recover any that was damaged.

Backup process is out of this scope.

You may want to check how to backup Linux systems using tools such as BackupPC.

Login to your System via Physical Console

Personally, I wont recommend any system upgrade to be done via SSH. What if you loose connection in the middle of upgrade? You brick your system!

So, use physical console or any direct access method.

Run Full System Update

Ensure that your system is up-to-date by executing the commands below.

Hold on, before we can ran upgrade, let’s confirm our Debian 11 system details;

hostnamectl

   Static hostname: debian11
         Icon name: computer-vm
           Chassis: vm
        Machine ID: a417481aacd84ee19371d9b5e109cf12
           Boot ID: 3300de73894747b1808316e1c4895158
    Virtualization: oracle
  Operating System: Debian GNU/Linux 11 (bullseye)
            Kernel: Linux 5.10.0-8-amd64
      Architecture: x86-64

The OS and the current Kernal details;

  • Operating System: Debian GNU/Linux 11 (bullseye)
  • Kernel: Linux 5.10.0-8-amd64

Debian Version;

cat /etc/debian_version
11.3

Now, proceed with system repositories update.

apt update

Run system upgrade;

apt upgrade --auto-remove

Once that is done, run the smart upgrade;

apt dist-upgrade

Reboot the System

Once the upgrade completes successfully, reboot the system to effect all the upgrade changes.

systemctl reboot

After system reboot, one thing to note is that my system has now moved to Debian 11.7 from Debian 11.3 after update.

Let’s move on to see how to now upgrade Debian 11.

Update System Repositories

In order to upgrade from Debian 11 to Debian 12, we need to update the current system repositories from Debian 11’s repos, bullseye, to Debian 12’s repos, bookworm.

These are my Debian 11’s current system repositories;

grep -ir bullseye /etc/apt/sources.list | grep -vE "^#"

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

So, we need to update them as follows;

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

The repos now look like;

grep -vE "^#|^$" /etc/apt/sources.list

deb http://deb.debian.org/debian/ bookworm main
deb-src http://deb.debian.org/debian/ bookworm main
deb http://security.debian.org/debian-security bookworm-security main
deb-src http://security.debian.org/debian-security bookworm-security main
deb http://deb.debian.org/debian/ bookworm-updates main
deb-src http://deb.debian.org/debian/ bookworm-updates main

Similarly, if you have custom repos in the /etc/apt/sources.list.d directory, then update them accordingly.

Optionally Install Non-Free-Firmware Repositories

Non-free-firmware repositories provide packages that requires a user to explicitly accept end user license agreement before a package can be installed. These repositories are usually required to install packages relating to various hardware such as WiFi controllers, Bluetooth, Graphics, Sound, e.t.c especially on Desktop systems.

If you therefore have non-free firmware installed it is recommended to add non-free-firmware to your APT sources-list. To install such repos, update the sources.list file as follows;


cat >> /etc/apt/sources.list << 'EOL'
# Non-Free-Firmware
deb http://deb.debian.org/debian bookworm non-free non-free-firmware
deb http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware
deb http://deb.debian.org/debian bookworm-updates non-free non-free-firmware
EOL

Remove bullseye-backports Repositories

If you have any bullseye-backports repositories installed, it is recommended to remove them from source-list files before the upgrade. If you really need them, you can add back after the upgrade.

grep -irl 'bullseye-backports' /etc/apt/sources.list* |\
 xargs -I {} sed -i '/bullseye-backports/s/^/#/' {}

Upgrading Debian 11 to Debian 12

It is time to upgrade!

Run system package cache update;

apt update

Next, perform minimal system upgrade to only update the existing packages without installing any new packages in the system

apt upgrade --without-new-pkgs

During the upgrade process, you will get apt-listchanges new!

Go through the news and press q to exit when done reading, -:)

You will also be prompted on whether to restart some services during upgrade. Accept (yes) and move forward.

Do full system upgrade now from Debian 11 to Debian 12;

apt full-upgrade

During upgrade, you will receive prompts on whether to override configurations of old packages with new configurations. For example;


Configuration file '/etc/nginx/nginx.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** nginx.conf (Y/I/N/O/D/Z) [default=N] ?

For me, I will choose to keep currently-installed version configs.

Review the prompts and proceed appropriately.

Reboot the System

Once the upgrade is done, reboot the system.

systemctl reboot

Verify System Upgrade

Once the system boots up, launch a terminal and start to check if everything is okay. Including any services that you might have installed on the previous OS version.

For us, let's check some basic system information.

hostnamectl

 Static hostname: debian11
       Icon name: computer-vm
         Chassis: vm 🖴
      Machine ID: a417481aacd84ee19371d9b5e109cf12
         Boot ID: 934ad7ae1e2a4679b8aedb7eedc6697b
  Virtualization: oracle
Operating System: Debian GNU/Linux 12 (bookworm)  
          Kernel: Linux 6.1.0-9-amd64 
    Architecture: x86-64
 Hardware Vendor: innotek GmbH
  Hardware Model: VirtualBox
Firmware Version: VirtualBox

We are now on Debian 12;

Operating System: Debian GNU/Linux 12 (bookworm)  
          Kernel: Linux 6.1.0-9-amd64
cat /etc/debian_version
12.0

And that is it! You have successfully upgraded your Debian 11 system to Debian 12.

That closes our guide on upgrading Debian 11 to Debian 12.

Other Tutorials

System/tools upgrades

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Kifarunix
Linux Certified Engineer, with a passion for open-source technology and a strong understanding of Linux systems. With experience in system administration, troubleshooting, and automation, I am skilled in maintaining and optimizing Linux infrastructure.

Leave a Comment