Debian 11 to 12

By Darren Nathanael on Sat, Feb 10, 2024


The upgrade need to be done on a root account aka superuser.

Backup your data!!!
Remember your data is precious, you don’t want to spend time recovering via system rescue do you?

Update Currently Installed Packages

Before upgrading, it is recommended to update the currently installed packages.

Packages marked as held back cannot be automatically installed, upgraded or removed. This may cause issues when upgrading to debian 11. To check wich package are held back, run the following command:

1apt-mark showhold

If there are on hold packages, you should unhold the packages with apt-mark unhold pkg_name.

Refresh the packages index and upgrade all installed packages:

1apt update
2apt upgrade

Run apt full-upgrade to perform a major version upgrade of the installed packages and may remove some unnecessary packages:

1apt full-upgrade

Remove the automatically installed dependencies that are no longer needed:

1apt autoremove

Step one

Reconfigure APT’s source-list files.

You can either open the /etc/apt/sources.list file with your text editor and replace each instance of bullseye with bookworm and bullseye/updates to bookworm-security. If you have other source list files under /etc/apt/sources.list.d, you need update those sources too.

The default file /etc/apt/sources.list should look something like this:

1deb [arch=amd64] bullseye main
2deb-src [arch=amd64] bullseye main
4deb [arch=amd64] bullseye-updates main
5deb-src [arch=amd64] bullseye-updates main
7deb [arch=amd64] bullseye-security main
8deb-src [arch=amd64] bullseye-security main

Update it so it looks something like this:

1deb [arch=amd64] bookworm main
2deb-src [arch=amd64] bookworm main
4deb [arch=amd64] bookworm-updates main
5deb-src [arch=amd64] bookworm-updates main
7deb [arch=amd64] bookworm-security main
8deb-src [arch=amd64] bookworm-security main

Alternatively, instead of manualy editing the files you can use the use the sed command:

1sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
2sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list

Step two

Update the packages index.

Update the bad boy:

1apt update
2apt upgrade

You may be asked if you want to restart or whether you want to keep an existing configuration file or to install the package maintainer’s version. Read the information carefully, and if you didn’t make any custom changes to the file, it is safe to type Y; otherwise, to keep the current configuration, enter N.

The upgrade may take some time, depending on the number of updates and your Internet speed.

Next, run apt full-upgrade, which will perform a complete upgrade of the system, install the newest versions of packages, and resolve dependency changes between packages in different releases. This will upgrade all packages that was not upgraded with the previous command.

1apt full-upgrade

The command may install some new packages and remove conflicting and obsolete packages.

After thats done, clean up the unnecessary packages with:

1apt autoremove

Finally, reboot your machine so that the new kernel is activated by typing:


Confirm the Upgrade

Wait for a few moments until your system boots up and log in. You can check the Debian version by using the lsb_release command:

1lsb_release -a


1root@haleema:/home/stevie/# lsb_release -a
2No LSB modules are available.
3Distributor ID:	Debian
4Description:	Debian GNU/Linux 12 (bookworm)
5Release:	12
6Codename:	bookworm

Thats it! gtfo and enjoy your new Debian 12.