Upgrade Debian 11 Bullseye to Debian 12 Bookworm
This guide explains how to upgrade Debian Linux from Debian 11 (Bullseye) to Debian 12 (Bookworm), which is the current stable release as of June 10th, 2023.
These steps can be preformed as an in place upgrade on a live system from either a local terminal or remote SSH session.
Step 1
Prior to upgrading, make sure the current system is up-to-date.
apt update && apt upgrade
Step 2
Switch the Debian repositories from Bullseye to Bookworm by editing the source file.
vi /etc/apt/sources.list
Replace all occurrences of the codename bullseye with bookworm.
Current source.list should look similar to this:
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
Modified source.list will look like this once you're done:
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
For Debian 12 onwards, all the packaged non-free firmware binaries that Debian can distribute have been moved to a new component in the Debian archive called non-free-firmware. If you had only enabled the non-free component on your system to allow firmware installation, you can safely remove it now. However, if you require these firmware binaries, you can add the following line after the main lines.
deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
Debian is distributed (mirrored) on hundreds of servers worldwide. In the example above, we have used a repository located in the United States. To speed up downloads, you can choose a Debian mirror based on your geographic location.
Third-party software installed from a repository will be disabled during the upgrade process. This may not apply to your system, so before starting, check for repository .list files within the /etc/apt/sources.list.d/ directory. If present, you'll need to update these after the upgrade. Consult the software distributor for instructions, as software from outside the standard Debian repositories may not support the new release.
Step 3
Update the package index.
apt update
Step 4
Upgrade the minimal base system. To minimize the risk of breaking the system during the early stages of a major version upgrade, it is recommended to use the --without-new-pkgs option. This ensures all current packages are updated without introducing new ones, thereby reducing the likelihood of dependency issues.
apt upgrade --without-new-pkgs
Step 5
Next, execute the full-upgrade, this will handle dependency changes, install new packages, and remove obsolete ones, completing the transition to the new release.
apt full-upgrade
Step 6
Reboot the system.
reboot
Step 7
Verify your release has been upgraded.
lsb_release -a
Output will be similar to this.
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm
Step 8
Clear out the local repository of retrieved package files and dependencies that are no longer required.
apt clean
apt autoremove