​How to upgrade Debian 11 to Debian 12 Bookworm

21 nov 2023 4 min di lettura
​How to upgrade Debian 11 to Debian 12 Bookworm
Indice dei contenuti

Introduction

The latest stable version of Debian, Debian 12, codenamed "bookworm", was released on June 10, 2023 and will be supported for five years. "bookworm" ships with tens of thousands of new packages and major software updates.

Debian 12 "bookworm" comes with the Linux 6.1 kernel series, Exim as the default email server, new translations, and a newer version of the desktop environments.

This article explains how to upgrade Debian 11 to Debian 12 "bookworm" via the command line.

Prerequisites

You must log in as root or as a user with sudo privileges to perform the update procedure. You can only upgrade to Debian 12 from Debian 11. If you have an older Debian version, upgrade to the next version first.

Back up your data

First, make sure to back up your data before starting the major update of your operating system. If you are running Debian on a virtual machine, it is recommended to create a full system snapshot so that if the upgrade goes awry, you can quickly restore your machine.

Update currently installed packages

Before starting the release upgrade process, you should upgrade all currently installed packages to the latest versions.

Packages marked as held cannot be automatically installed, updated, or removed. This may cause problems during the update process. To check if there are any packages held on your systems, run:

sudo apt-mark showhold

If there are on-hold packages, you should remove them with sudo apt-mark unhold package_name or make sure the packages do not interfere with the upgrade process.

Update the package index and update all installed packages:

sudo apt update
sudo apt upgrade

Perform a major version upgrade of installed packages:

sudo apt full-upgrade

The above command may also remove some unnecessary packages.

Remove automatically installed dependencies that are no longer needed by any package:

sudo apt autoremove

Update Debian 11 Debian 12 Bookworm

The first step is to reconfigure the APT source list files.

To do this, open the /etc/apt/sources.list file with your text editor and replace each instance of bullseye with bookworm. If there are other third-party source list files in the /etc/apt/sources.list.d directory, we recommend that you disable those sources.

The default Debian 12 /etc/apt/sources.list file looks like this:

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 terminal output to English only:

export LC_ALL=C

Once done, update the package index:

sudo apt update

If there are errors or warning messages related to a third-party repository, try fixing the problem or disabling the repository.

Start the system update by updating the installed packages. This will only update those packages that do not require installing or removing other packages:

sudo apt upgrade

The system will ask you if you want services to restart automatically during the update.

Restart services during package upgrades without asking?

During the upgrade process, you may also be asked other questions, such as your Exim configuration or whether you want to keep an existing configuration file or install the maintainer version of the package. Read the information carefully, and if you haven't made any custom changes to the file, it's safe to type Y ; otherwise, to keep the current configuration, enter N.

The update may take some time, depending on the number of updates, your system hardware, and your Internet speed.

Once the upgrade is complete, run apt full-upgrade, which will perform a full system upgrade, install the latest package versions, and resolve dependency changes between packages in different versions. This will update any packages that were not updated 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 unnecessary packages with the following:

sudo apt autoremove

Finally, restart your computer so that the new kernel is activated by typing:

sudo systemctl reboot

Confirm the update

Wait a few moments until the system boots up and log in.

You can check your Debian version 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 all. You have successfully updated your system to the latest Debian 12 version.

Conclusion

Upgrading to Debian 12 is a relatively simple process.

If you encounter an error, please visit the Upgrades from Debian 11 (bullseye) page, which covers known issues that may occur during an upgrade to Debian 12.

Buy me a coffeeBuy me a coffee

Supportaci se ti piacciono i nostri contenuti. Grazie.

Successivamente, completa il checkout per l'accesso completo a Noviello.it.
Bentornato! Accesso eseguito correttamente.
Ti sei abbonato con successo a Noviello.it.
Successo! Il tuo account è completamente attivato, ora hai accesso a tutti i contenuti.
Operazione riuscita. Le tue informazioni di fatturazione sono state aggiornate.
La tua fatturazione non è stata aggiornata.