How to upgrade from Debian 11 / Bullseye Debian 12 / Bookworm

Table of Contents

Step by step upgrade process

Step 1 - Change your apt sources

# sed -i -e 's/bullseye/bookworm/g' /etc/apt/sources.list

or equivalent, depending on the various sources of packages you’ve defined on your system.

Step 2 - Refresh your apt cache

# apt update

Step 3 - Upgrade existing packages

# apt upgrade --without-new-pkgs

This will not try to install new packages during the upgrade process.

During the upgrade, you may see prompts telling you that a configuration file has been locally modified and that the new version of the package provides a different version:

  • Do you want to keep your locally modified file ?
  • Do you want to install the package maintainer version ?

There is no absolute answer to those kind of prompts. It all depends on the software being upgraded, and the modification you may have done.

Take your time to carefully review the modifications / changes before answering the questions.

Step 4 - Do the final upgrade

# apt full-upgrade

Same as above, it’s very likely that you see some prompts asking you to make a choice about which version of a modified file should be kept.

Step 5 - Final check before reboot

Step 5.1 - Make sure that OpenSSH server configuration is OK

If you’re on a remote system, it’s always a good idea to make sure that your OpenSSH server has a valid configuration. Especially since Bookworm introduces a major OpenSSH server version upgrade, from 8.x to 9.x.

# sshd -t

Here is what the sshd(8) man page says about -t option:

 -t      Test mode.  Only check the validity of the configuration file and sanity of the keys.  This is useful for updating sshd reliably as configuration options
         may change.

Step 5.2 - Check that your firewall is performing as expected

It’s always a good idea to make sure that your firewall has properly loaded your rules after an O.S upgrade. Especially if you’re doing traffic whitelisting.

# nft list ruleset

and visually inspect that everything is okay.

Step 6 - Final reboot

Now is the time, you’re ready to perform the final reboot to complete the upgrade process and boot into your new Bookworm Debian system.

Brace yourself but keep cool, it’s gonna be okay:

# reboot

One can also use:

  • # systemctl reboot
  • # at now <<< reboot, my personal favorite

Me when I hit the "reboot" command and waits for command prompt to come back Me when I hit the "reboot" command and waits for command prompt to come back

Final words

My migration from Debian 11 to Debian 12 took me less than an hour. It was almost transparent (yes, I’m starring at you thruk and naemon that are just not working on my Bookworm setup at the moment).

Just a huge thank you to all the people involved in the Debian project that have made this major upgrade so accessible.