Image generated by OpenAI's DALL·E
Debian, which has long been considered the basis for stable and reliable Linux systems, has released its latest masterpiece: Debian 12 "Bookworm". For those who have been running systems for longer periods of time, now is the time to update existing Debian 11 installations.
Debian 11 will be phased out of Debian LTS support on June 30, 2026 and will therefore no longer receive security updates - from this point onwards an update to Debian 12 is recommended.
In this blog post we will look at the practical aspects and go through the steps to safely upgrade a Debian 11 to Debian 12. From preparing the repositories to updating the repositories to executing the upgrade process, we will discuss each step. We will go through this using a "normal" system as an example - if there are some adjustments to the existing system or further points need to be taken into account, Debian offers its own article to shed light on all points. This should be considered BEFORE upgrading.
Ready? :-)
Before we start the upgrade to Debian 12 "Bookworm", it is important to ensure that our current Debian system is up to date.
Complete upgrade of the existing system
First, let's update the package lists and check what updates are available, but without installing them immediately:
apt-get update
We then upgrade all packages:
apt-get upgrade
apt-get dist-upgrade
These commands will bring your current stable system up to date. The "-y" option would allow the upgrade to be performed non-interactively without having to confirm each time.
As a final step, we should uninstall all packages that are no longer needed:
apt-get autoremove
In order to prepare the system for the next steps, it is recommended to restart the server.
reboot
Adjustment of the repository files
In order to enable the update to Debian 12, the repository sources must be adjusted. This can be done manually in the files or with the following command.
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list
Example:
The file /etc/apt/sources.list contains Debian's own repositories - after manual adjustment or the commands above, it should look like this (just an excerpt):
Before:
...
deb https://deb.debian.org/debian bullseye main
...
After:
...
deb https://deb.debian.org/debian bookworm main
...
Performing the upgrade
First, the customized package sources must be queried.
apt-get update
The two commands that take the most time must then be issued - this may result in queries and comments that need to be answered (depending on the installed packages and the configuration). For example, whether the current configuration should be kept or the new one from the package should be used.
Update existing packages - without installing new packages.
apt-get upgrade --without-new-pkgs
The next step is to start the upgrade.
apt-get full-upgrade
Finally, the system must be restarted one last time.
reboot
Completion
After the reboot, the new version can be validated with the following command.
lsb_release -a
Debian 12 should now appear here.
...
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
....
Now the system should be checked for functionality and any necessary adjustments made.