How to Upgrade Debian 10 Buster to Debian 12 Bookworm

A reference to heart rate monitor with black and red colors
A reference to heart rate monitor with black and red colors. Source: Internet Archive, Software maintenance and computers, 1990 .

Overview

It’s not permitted to jump Debian releases, so we need to upgrade two times, from Debian 10, to 11, then 12.

My server has 4 main apps:

To upgrade, it’s extremely important to follow the official docs, I’m sharing my personal experience with the upgrade. So don’t just go copy and paste the commands from this guide, read the docs first.

Debian 10 -> Debian 11: https://www.debian.org/releases/bullseye/i386/release-notes/ch-upgrading.en.html Debian 11 -> Debian 12: https://www.debian.org/releases/bookworm/i386/release-notes/ch-upgrading.en.html

This entire process took me 2 hours.

From Debian 10 Buster to Debian 11 Bullseye

Preparing the upgrade

 1apt update && apt upgrade
 2# if required, you need to put the system in a "clean" state
 3apt autoremove
 4
 5# remove old leftover of etc config files
 6find /etc -name '*.dpkg-*' -o -name '*.ucf-*' -o -name '*.merge-error'
 7# ONLY RUN THIS AFTER CHECKING THE ABOVE COMMAND, BE SURE NO IMPORTANT FILES ARE HERE
 8find /etc \( -name '*.dpkg-*' -o -name '*.ucf-*' -o -name '*.merge-error' \) -exec rm -v {} \+
 9
10# configuring pending packages
11dpkg --audit
12dpkg --configure --pending
13
14# updating source lists
15sed -i.bak 's/buster/bullseye/g' /etc/apt/sources.list
16# necessary since security section changed name layout
17sed -i.bak2 's/bullseye\/updates/bullseye-security/g' /etc/apt/sources.list
18

Doing the upgrade

 1# recording the update session to understand errors
 2script -t 2>~/upgrade-bullseyestep.time -a ~/upgrade-bullseyestep.script
 3
 4# as docs, minimal upgrade first
 5apt update
 6apt upgrade --without-new-pkgs
 7
 8# full upgrade, fingers crossed :)
 9apt full-upgrade
10
11# if all OK, time for a reboot
12reboot

Post install

You should check all the services, check if they are working correctly and check all website status.

1# check packages that needs removal and remove them
2apt update && apt upgrade
3apt autoremove
4
5# check OS release
6cat /etc/os-release

You are done! Next, lets continue with Debian 12.

From Debian 11 Bullseye to Debian 12 Bookworm

Since we already did the preparation from the last upgrade and our system is in a “clean state”, the upgrade process is easier.

Preparing the upgrade

1# remove old leftover of etc config files
2find /etc -name '*.dpkg-*' -o -name '*.ucf-*' -o -name '*.merge-error'
3# ONLY RUN THIS AFTER CHECKING THE ABOVE COMMAND, BE SURE NO IMPORTANT FILES ARE HERE
4find /etc \( -name '*.dpkg-*' -o -name '*.ucf-*' -o -name '*.merge-error' \) -exec rm -v {} \+
5
6# updating source lists
7sed -i.bullseye 's/bullseye/bookworm/g' /etc/apt/sources.list

Doing the upgrade

 1# recording the update session to understand errors
 2script -t 2>~/upgrade-bookwormstep.time -a ~/upgrade-bookwormstep.script
 3# as docs, minimal upgrade first
 4apt update
 5apt upgrade --without-new-pkgs
 6
 7# full upgrade, fingers crossed :)
 8apt full-upgrade
 9
10# if all OK, time for a reboot
11reboot

Post install

You should check if all the services are working again, check if they are working correctly and check all website status.

1# check packages that needs removal and remove them
2apt update && apt upgrade
3apt autoremove
4
5# check OS release
6cat /etc/os-release

Cleaning the new system

With all the upgrades, residual configuration, and obsolete packages may be present.

 1# list residual configurations
 2apt list '~c'
 3# list obsolete packages
 4apt list '~o'
 5
 6# remove them
 7apt purge '~c'
 8apt purge '~o'
 9
10# reboot and check the system again
11reboot

Conclusion

Upgrading 2 major Debian versions was very easy. Approximately +1GB of disk space was used, and I didn’t have to intervene in the installed applications.

This entire process took me 2 hours.


comments powered by Disqus