How to Upgrade Debian 11 to Debian 12 Bookworm
Updated on
•6 min read

The latest Debian stable version, Debian 12, codenamed “bookworm”, was released on 10th June 2023, and it will be supported for five years. “bookworm” comes with tens of thousands of new packages and major software upgrades.
Debian 12 “bookworm” ships with Linux 6.1 kernel series, Exim as a default email server, new translations, and a newer version of desktop environments.
This article explains how to upgrade Debian 11 to Debian 12 “bookworm” via the command line.
Prerequisites
You need to be logged in as a root or a user with sudo privileges to perform the upgrade procedure. You can only upgrade to Debian 12 from Debian 11. If you have an older Debian version first update it to the next version.
Backup Your Data
First and foremost, make sure you backup your data before starting the major upgrade of your operating system. If you are running Debian on a virtual machine, it is recommended to make a complete system snapshot so that if the update goes wrong, you can quickly restore your machine.
Update Currently Installed Packages
Before starting the release upgrade process, you should update all your currently installed packages to their latest versions.
Packages marked as held back cannot be automatically installed, upgraded, or removed. This may cause issues during the upgrade process. To check whether there are held-back packages on your systems run:
sudo apt-mark showhold
If there are on-hold
packages, you should either unhold the packages with sudo apt-mark unhold package_name
or ensure the packages will not interfere with the upgrade process.
Refresh the packages index and upgrade all installed packages:
sudo apt update
sudo apt upgrade
Perform a major version upgrade of the installed packages:
sudo apt full-upgrade
The command above may also remove some unnecessary packages.
Remove the automatically installed dependencies that are no longer needed by any package:
sudo apt autoremove
Upgrade Debian 11 Debian 12 Bookworm
The first step is to reconfigure APT’s source-list files.
To do so, open the /etc/apt/sources.list
file with your text editor
and replace each instance of bullseye
with bookworm
. If you have other third-party source-list files under the /etc/apt/sources.list.d
directory, it is recommended that you disable those sources.
The default Debian 12 /etc/apt/sources.list
file looks something like below:
deb https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-proposed-updates contrib main non-free non-free-firmware
deb https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware
# deb-src https://ftp.debian.org/debian/ bookworm-backports contrib main non-free non-free-firmware
deb https://security.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware
# deb-src https://security.debian.org/debian-security/ bookworm-security contrib main non-free non-free-firmware
You can find a list of all Debian mirror addresses here .
Set the terminal output to English only:
export LC_ALL=C
Once done, update the packages index:
sudo apt update
If there are any errors or warning messages related to a third-party repository, try fixing the issue or disabling the repository.
Start the system upgrade by upgrading the installed packages. This will upgrade only those packages that don’t require any other packages to be installed or removed:
sudo apt upgrade
The system will ask whether you want the services to be automatically restarted during the upgrade.
Restart services during package upgrades without asking?
During the upgrade process, you may also be asked other questions, like configuring Exim or whether you want to keep an existing configuration file or install the package maintainer’s version. Read the information carefully, and if you didn’t make any custom changes to the file, it is safe to type Y
; otherwise, to keep the current configuration, enter N
.
The upgrade may take some time, depending on the number of updates, system hardware, and your Internet speed.
When the upgrade is completed, execute apt full-upgrade
, which will perform a complete upgrade of the system, install the newest versions of the packages, and resolve the dependency changes between packages in different releases. This will upgrade all packages that were not upgraded with the previous command.
sudo apt full-upgrade
The command may install some new packages and remove conflicting and obsolete packages.
Once done, clean up the unnecessary packages with the following:
sudo apt autoremove
Finally, reboot your machine so that the new kernel is activated by typing:
sudo systemctl reboot
Confirm the Upgrade
Wait for a few moments until your system boots up and log in.
You can check the Debian version by using the following command:
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 12 (bookworm)
Release: 12
Codename: bookworm
That’s it. You have successfully upgraded your system to the latest Debian 12 realize.
Conclusion
Upgrading to Debian 12 is a relatively straightforward process.
If you hit any error, visit the Upgrades from Debian 11 (bullseye) page, which covers the known issues that might happen during an upgrade to Debian 12.