How to Upgrade from Debian 11 to Debian 12

Debian 12, codename "Bookworm" was released on the 10th of June 2023. It is a stable release and is supported for the next 5 years. This release updates many well-known packages, including Linux Kernel 6.1 LTS, Apache 2.4.57, MariaDB 10.11, and more.

Before upgrading to Debian 12, you should do the following things:

  • Back up all your files on a external drive.
  • Make sure you have a stable internet connection.

This article will show you how to upgrade from Debian 11 (Bullseye) to Debian 12 (Bookworm) in a few easy steps.

Update the System

Login to the server as root user. If you are not root yet, run the following command:

su -

Verify your operating system version using the following command:

lsb_release -a

You should see the following output:

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

If that's not the case, you are most likely not running Debian 11 and should not follow this guide further. Otherwise, you can continue with the next step:

Now you must update and upgrade all your system packages to the latest version. Run the following command to update and upgrade all packages:

apt-get update
apt-get upgrade
apt-get dist-upgrade

Next, remove all unwanted packages with the following command:

apt-get autoremove

After that, you shall restart your system to apply all updates:


Update repository files

We will now update the repository sources to use the Debian 12 Bookworm repository.

To do so, you can update all source files by running these commands:

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

Or edit the APT source file manually with the following command:

nano /etc/apt/sources.list

Replace "bullseye" with "bookworm". The result should be similar to the one below:

deb bookworm main contrib non-free
deb bookworm-updates main contrib non-free
deb bookworm-security main

Save and close the file when you are finished. If there are more APT source files in /etc/apt/sources.list.d/, edit these as well by replacing "bullseye" with "bookworm".

As of Debian 12 "Bookworm", all non-free firmware packages (i.e. firmware-amd-graphics, firmware-iwlwifi, firmware-misc-nonfree) have been moved to their own archive component ("non-free-firmware"). If you have non-free firmware packages installed on your system, you need to add this in the sources.list file.


deb bookworm main

Would become:

deb bookworm main non-free-firmware

Upgrade the operating system from Debian 11 (bullseye) to Debian 12 (bookworm)

At this point, your server is ready for the upgrade.

First, update the repository to apply the changes you made in the previous step.

apt-get update -y

During the process of updating, the system might query you for input, for example when it wants to restarts services, update configuration file, or read the release notes. Go through these queries one by one. For configuration files, it's usually best to compare the differences between the current version and proposed new version of your configuration file.

Update the existing packages without installing new ones:

apt-get upgrade --without-new-pkgs -y

Once this is done, run the following command to start the upgrade:

apt-get full-upgrade -y

Once your system has been upgraded, restart it to apply all the updates.


Verify the upgrade

You can now verify the upgrade using the following command:

lsb_release -a

You should see the Debian 12 version in the following output:

No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm


Your server is now upgraded to the latest Debian LTS release. If you have any problems, please create a post in our forum.

Share this page:

4 Comment(s)