How to Upgrade Debian Bullseye to Bookworm

Debian released the new stable version 12 in June 2023. The codename this time is Bookworm, and this is the little green worm from Toy Story. If you run version 11 of Debian, you will have support roughly until June 2026. Those who don’t want to wait can follow this tutorial for the upgrade.

Prerequisites and important notices

Do an upgrade locally or via SSH, only. Other services like telnet can be terminated during the upgrade process and it can happen that you are not able to access the system again.

Before you start to upgrade, it’s a good idea to make a backup from your critical data like etc/ and your /home directory. Don’t forget to backup your database and web and mail data if necessary.

The next step is to update the current release of Debian with the following commands:

$ apt-get update
$ apt-get upgrade
$ apt-get full-upgrade

This article covers the pure bullseye upgrade without third-party packages. Run one of the following commands to list third-party packages installed on your machine.

$ aptitude search '~i(!~ODebian)'
$ apt-forktracer | sort

Prepare the File

Take a look at your /etc/apt/sources.list file and check if the system is pointing to the bullseye repositories. The content should look similar to the snippet below.

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

# buster-updates, previously known as 'volatile'
deb http://deb.debian.org/debian/ bullseye-updates main
deb-src http://deb.debian.org/debian/ bullseye-updates main

Run the following commands to list any package, which is not ready to upgrade. Fix the broken package, before you proceed.

$ dpkg --audit
$ dpkg --get-selections | grep 'hold$'

Ensure that all backups are updated because the critical part starts now. Edit the
editor /etc/apt/sources.list file and change the version from bullseye to bookworm.

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

Since the bookworm release, it is possible to install non-free firmware. If this is something you want to use, you can add the line to your sources.list

deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware

Start the Upgrade Process

The next two commands will clean and update the packages:

$ sudo apt-get clean
$ sudo apt-get update

# Optional check if the packages are upgradable
$ apt list --upgradable

Now let’s start the major release upgrade. If anything goes wrong, you will be happy to have a backup. To avoid update issues, we will run a two-part update process. The first update installs packages where no other packages need to be removed or installed. The second part performs a full upgrade, resolving dependencies between different releases. By the way, this process takes some time and you can grab your coffee and do some other stuff next to the upgrade process. But keep an eye on the process, because it needs some user input during the time. For instance, it will ask you if you want to keep your configurations or if you want to modify them.

$ sudo apt-get upgrade
$ sudo apt-get full-upgrade

The last step is to clean up unnecessary packages from the system and reboot the system. Check the list of autoremove to keep the packages that you still want to use.

$ sudo apt-get autoremove
$ sudo reboot

With the following commands, you can check the version of your Debian system:

$ uname -a; lsb_release -a
$ cat /etc/os-release

Now, you should see the following output and enjoy your success:

Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm

For more detailed information take a look at the official documentation from Debian. Stay safe, let a comment and hit the like button if you like my article.

chevron_left

Leave a comment

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

Comment
Name
Email
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.