Upgrade time can be a daunting time specially if you are new or not that confident in performing upgrades, I will be covering the basics of upgrading which will allow you to perform an upgrade of your Debian 11 to a Debian 12 system.

The first thing that you want to do before making any changes is make sure you are familiar with the server and it's primary function, for example is it a mail server, web server database server, file server etc... this will then enable you to test it's primary function once the upgrade has completed and spot any major problems that may crop up.

You will also want to ensure that you have a backup and that you are able to restore that backup in the event that it's required. If it's a virtual machine then take a snapshot if possible. You should also consider how you will access the machine if there are problems, do you have physical access or remote access via an IPKVM/IPMI the last thing you want is for the server to go down in a remote location and you can't get onto it or boot a live cd of some sort to try and fix it.

As a general rule of thumb, the less additional or 3rd party software installed on your system, the higher chance for a successful upgrade, if you have installed any 3rd party software or manually installed software then you should check if this will upgrade with the rest of the system, in some cases you may need to remove the software prior to performing the upgrade.

Upgrade existing system

Before starting the upgrade to Debian 12 you will need to ensure that your system is fully up-to-date

apt update
apt upgrade
apt full-upgrade

Checks for partially installed, missing and obsolete packages.

dpkg -C

Check what packages are held back if any.

apt-mark showhold

Before proceeding make sure you don't have any issues with packages or packages on hold.

Update Sources

The system should now be fully updated with no issues with packages so we can now update the sources.list file with the Debian Stretch sources.

Make a backup the current /etc/apt/sources.list

cp /etc/apt/sources.list /etc/apt/sources.list_backup_`date +%Y-%m-%d_%H-%M`

Edit your sources.list file and update the keyword bullseye to bookworm.


deb bullseye main
deb-src bullseye main

deb bullseye-security main
deb-src bullseye-security main

deb bullseye-updates main
deb-src bullseye-updates main


deb bookworm main
deb-src bookworm main

deb bookworm-security main
deb-src bookworm-security main

deb bookworm-updates main
deb-src bookworm-updates main

or if you are feeling lazy you can use sed to update your sources lists

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

If you have other repos that need updating then you can do them.

Upgrading The System

When upgrading the system will prompt for user input so be aware of this so don't issue the command and run!! After the sources are updated you will need to update the packages list then start the upgrade process

apt update
apt upgrade
apt full-upgrade

After the updates have completed reboot the server and then check reported version and services

lsb_release -a

To clean up any old files you can run apt --purge autoremove which will clean up any old packages.

apt --purge autoremove

You should now have your system fully upgraded to Debian 12 Bullseye.

Add a comment

0.0(0 votes)

Previous Post