How to Upgrade to Debian 12 from Debian 11

4 min


Here’s how you can upgrade to Debian 12 “Bookworm” from Debian 11 “Bullseye”.

Debian 12 Bookworm is releasing shortly. If you are running Debian 11 Bullseye, you can plan to upgrade your desktop or server now. However, it is recommended that you wait until the first point release, i.e. 12.1 of Debian Bookworm, for critical server upgrades.

That said if you want to check out the cool features of Debian 12, check out this article. Here are the detailed steps to upgrade.

Upgrade to Debian 12 from Debian 11

  • Whether you are running a Debian server or any desktop version, make sure to take backups of critical data. For example, you might want to take backups of your documents for a desktop. If it is a server, keep a note of the services you are running. You can use rsync or any other utilities to do that.
  • Debian 12 is introducing a new repo, “non-free-firmware”, for proprietary drivers and packages. If you are using any “closed-source” network, display, graphics or any other drivers, you may need to configure them after the upgrade.
  • For network drivers, make sure to note down the content of the /etc/network/interfaces and /etc/resolv.conf files somewhere safe. If you lose network connection after the upgrade is complete, you can set it up easily by following this guide.
  • From the command prompt, run the following command to make sure Debian 11 is up to date with security and other packages.
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt autoremove
  • Once the above commands are complete, reboot the Debian 11 system.
sudo systemctl reboot
  • Note down a few pieces of information about Debian 11. This is important for servers. These include the Kernel version and the Debian version. The reason is you can verify the same commands below after the upgrade whether the upgrade is successful.
  • For example, the system I am trying to upgrade is Debian 11.7, and Kernel is 5.10.
uname -mr

Example output:

5.10.0-23-amd64   x86_64
cat /etc/debian_version

Example output:

11.7
  • Take backups of the APT source file to any directory of your choice.
sudo cp -v /etc/apt/sources.list /home/arindam/
sudo cp -vr /etc/apt/sources.list.d/ /home/arindam/
  • Open the /etc/apt/sources.list file and add the Debian 12 “bookworm” code name by replacing “bullseye“.
sudo nano /etc/apt/sources.list
  • Here’s the file before the changes in my test system for your reference.
deb http://deb.debian.org/debian/ bullseye main
deb-src http://deb.debian.org/debian/ bullseye main

deb http://security.debian.org/debian-security bullseye-security main
deb-src http://security.debian.org/debian-security bullseye-security main

deb http://deb.debian.org/debian/ bullseye-updates main
deb-src http://deb.debian.org/debian/ bullseye-updates main
  • Here’s the file after the changes. The mirror URLs below are for default settings. If you are using a different Debian mirror, keep those unchanged.
deb http://deb.debian.org/debian/ bookworm main
deb-src http://deb.debian.org/debian/ bookworm main

deb http://security.debian.org/debian-security bookworm-security main
deb-src http://security.debian.org/debian-security bookworm-security main

deb http://deb.debian.org/debian/ bookworm-updates main
deb-src http://deb.debian.org/debian/ bookworm-updates main

deb http://deb.debian.org/debian bookworm non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm non-free non-free-firmware

deb http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware
deb-src http://deb.debian.org/debian-security bookworm-security non-free non-free-firmware

deb http://deb.debian.org/debian bookworm-updates non-free non-free-firmware
deb-src http://deb.debian.org/debian bookworm-updates non-free non-free-firmware
updating sources file
Updating sources file

Note: From Debian 12 Bookworm onwards, the Debian team created a new repo non-free-firmware, to package the non-free packages. Hence, the last three sections included the same in the above example.

  • Save the file and exit.
  • Open the terminal and run the following command to start the upgrade process.
sudo apt update
sudo apt full-upgrade
Upgrade process -1
Upgrade process -1
Debian 12 Upgrade process in progress
Debian 12 Upgrade process in progress
  • During the upgrade, the installer might ask you about several services being restarted. Hit yes after carefully reading the messages. Also, if you see any prompts with ":", hit "q" to quit the message.
Confirmation about service verifications
Confirmation about service verifications
  • Wait for the download and installation of the packages.
  • After the upgrade is complete, reboot your Debian desktop or server.
sudo systemctl reboot

Check the upgrade status

After reboot, verify whether you are running Debian 12. You can check the Debian version using the following file.

cat /etc/debian_version

Example output:

Debian 12 Bookworm Desktop (Xfce)
Debian 12 Bookworm Desktop (Xfce) – After upgrading from Debian 11
  • Also, if you have just upgraded to a Debian 12 server, make sure to verify services running, such as HTTP, ssh and so on. You can use the below systemd command to learn about the services running.
systemctl list-units --type=service

Conclusion and cleaning up

After you verified all the steps are complete, you may want to run apt autoremove to clean up unwanted packages. But be careful while doing it.

sudo apt --purge autoremove

So, that’s the brief set of steps to upgrade to Debian 12. I hope your upgrade goes smoothly. If you are running Debian 11 on a critical server, do not upgrade now. Wait for the Debian 12.1 release.

For more information about the Debian upgrade, visit the official documentation.

Finally, don’t forget to let us know how your upgrade went.


Arindam

Creator and author of debugpoint.com. Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

7 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments