How to Upgrade Debian 11 to Debian 12 (Bookworm) via CLI

Are you planning to upgrade to the latest release of Debian 12 (codenamed “Bookworm”), from Debian 11? But did you know that instead of downloading the Debian 12 ISO file and installing it, you can simply upgrade your existing Debian 11 to Debian 12 by following a few steps? Yes, you heard right.

In this blog, we will discuss the simple procedure of upgrading Debian 11 to Debian 12.

Why Should Upgrade to Debian 12 (Bookworm) from Debian 11?

The stable version of Debian 12 was released recently on 10th June 2023, after the development of almost one year and ten months. The Debian 12 codename is “Bookworm” and it will be supported for the coming five years.

People are planning to move to Debian 12 due to various reasons, let’s list a few of them:

  • It has introduced over 11,089 new packages, and 43,254 existing packages have been updated.
  • It includes a large number of translated man pages in multiple languages, such as German, Greek, Finnish, Indonesian, Czech, Norwegian, Swedish, Vietnamese, Serbian, Russian, and more.
  • It has an improved installer and supports multiple desktop environments like GNOME, Plasma, LXDE, KDE, LXQt, Xfce, and MATE.
  • It supports nine architectures: 64-bit ARM, ARMv7, IBM System Z, 32-bit PC (i386) and 64-bit PC, ARM EAB, and more. However, it does not support any i586 processor of a 32-bit PC. If you have one you should keep enjoying Debian 11.
  • It has introduced a brand-new repository called “non-free-firmware” that separates non-free firmware from the remaining non-free packages. This aids in enabling the proper functioning of hardware components, such as network adapters or graphics cards.
  • It contains many updated software packages including Apache 2.4.57, GnuPG 2.2.40, Nginx 1.22, PostgreSQL 15, OpenJDK 17, Vim 9.0, and the list goes on.

To know more about the benefits of Debian 12, hop to the Debian release webpage.

Note: Before upgrading Debian 11, make sure to back up important data and files. For that purpose, you can use different backup utilities like the rsync command.

Now power on your Debian 11 and start following the procedure to smoothly upgrade Debian 11 to Debian 12 in just a few minutes.

Upgrading to Debian 12 from Debian 11

To upgrade to Debian 12 (bookworm) from Debian 11 (Bullseye), follow the steps listed below:

Step 1: Check Debian Version

To check the Debian distribution name and version number, execute the following command in the terminal of Debian 11.

$ lsb_release -d

Description:	Debian GNU/Linux 11 (bullseye)

Let’s now display the version number of our Debian 11 using the cat command.

$ cat /etc/debian_version

11.7
Check Debian Release Version
Check the Debian Release Version

Step 2: Update Debian 11 Packages

The next step is to upgrade the installed packages by running apt commands:

$ sudo apt update
$ sudo apt upgrade

Both these commands will consume some time, wait for the completion.

Update Debian 11 Packages
Update Debian 11 Packages

Once the package list is up-to-date, it’s a better approach to remove unnecessary packages from your system by executing.

$ sudo apt --purge autoremove 

Step 3: Update /etc/apt/sources.list File

It’s time to modify the package sources to point to the Debian 12 repositories. For that purpose open the “sources.list” using any text editor, here we will be using the nano editor:

$ sudo nano /etc/apt/sources.list

After the execution of the above command, the “source.list” file will open in the terminal using the nano editor. Observe the places where the package sources indicate to Debian 11 (bullseye):

Debian Sources File
Debian Sources File

Now replace all instances of “bullseye” with “bookworm” as shown 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
Update Debian Sources Repository
Update Debian Sources Repository

Step 4: Upgrade to Debian 12

As the package sources are modified, let’s update the repositories by typing:

$ sudo apt update
Update Debian 12 Packages
Update Debian 12 Packages

After the “update” command, execute the following command to upgrade the existing packages:

$ sudo apt upgrade --without-new-pkgs
Upgrade Debian 12 Packages
Upgrade Debian 12 Packages

To finish the upgrade process, follow the on-screen instructions carefully, as the process may ask you a few questions such as “Would you like to restart the service?” or “Keep or erase configuration file options?” throughout the process.

Configure libc6
Configure libc6

Finally, execute the command listed below to do a full system upgrade to Debian 12.

$ sudo apt full-upgrade
Fully Upgrade Debian
Fully Upgrade Debian

When the ':' icon will appear, press enter until a configuration window appears. In the package configuration window, select “OK”.

Configure debconf
Configure debconf

Select the desired locale for the system and click on the “OK” button.

Configure Locale
Configure Locale

Select the font for your Debian 12 and press “OK”.

Configure Console Font
Configure Console Font

The package configuration will also ask to install the “ca-certificate” package.

Install CA Certificate
Install CA Certificate

Some prompts will appear to restart some of the services like libc and libssl. Select “Yes” for these prompts to continue:

Configure libc6
Configure libc6

After the completion of the full upgrade, reboot the system to enjoy your upgraded Debian 12.

$ sudo systemctl reboot

The login screen will display Debian 12 having the same users and credentials as Debian 11.

Debian 12 User Login
Debian 12 User Login

Open the terminal in your new Debian 12 and run the provided commands, which will display the system information:

$ lsb_release -a
$ cat /etc/debian_version

Step 5: Remove Unwanted Packages from Debian

As we upgraded from Debian 11 to Debian 12, there must be many obsolete or unwanted packages. To remove all those packages, type this command:

$ sudo apt --purge autoremove

All the unnecessary packages are removed from Debian 12.

Conclusion

The newly released Debian 12 offers numerous benefits, including updated software packages, enhanced security, improved hardware support, and new features.

The user can easily upgrade to Debian 12 from the existing Debian 11 by modifying the package sources to point to the Debian 12 repositories (bookworm) and then fully upgrading the system.

Hey TecMint readers,

Exciting news! Every month, our top blog commenters will have the chance to win fantastic rewards, like free Linux eBooks such as RHCE, RHCSA, LFCS, Learn Linux, and Awk, each worth $20!

Learn more about the contest and stand a chance to win by sharing your thoughts below!

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

6 Comments

Leave a Reply
    • @Mike,

      You’re welcome! I’m glad to hear that the upgrade to Debian 12 on your M1 Macbook via UTM went smoothly. If you have any more questions or need further assistance in the future, feel free to reach out.

      Reply
  1. I had a nonfirmware version that required to update/upgrade from DVD CDROM which was a pain. I followed your instructions and I was able to upgrade seamlessly.

    Great job and Shout out.

    Reply
  2. I don’t think you need to include backports in repositories like they did in this example for some reason. That was a bit inconsistent as they did not have them in 11. Weird that…

    Reply
    • @Tony,

      The reason for including backports is because Debian is a rolling release distribution, which means that it is constantly being updated with new packages. This means that backports are often necessary to provide newer features or bug fixes to older Debian distributions.

      Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.