Skip to main content

Upgrade Debian 11 (Bullseye) to Debian 12 (Bookworm)

Upgrading your Debian system is crucial for accessing new features and security enhancements. Here's a comprehensive guide on upgrading from Debian 11 (Bullseye) to Debian 12 (Bookworm), based on reliable sources.


Prerequisites

  1. Superuser Privileges: You must perform the upgrade with superuser privileges. Log in as root or a user with sudo privileges.
  2. Data Backup: Back up your data before starting the upgrade. If you're using a virtual machine, consider taking a complete system snapshot.

Update All Currently Installed Packages

Ensure your Debian 11 system is fully updated before the upgrade. Use the following APT commands and then reboot the system.

sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt --purge autoremove
sudo reboot

Check for Installed Non-Debian Packages

Inspect your system for non-Debian packages, as they might cause complications during the upgrade. You might need to uninstall non-critical software installed from external repositories.

sudo apt list '?narrow(?installed, ?not(?origin(Debian)))'

Update Software Sources Files

Reconfigure your APT sources to point to the Debian 12 repositories. Backup current sources first, then update them to target 'Bookworm'.

mkdir ~/apt
cp /etc/apt/sources.list ~/apt
cp -r /etc/apt/sources.list.d/ ~/apt
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*

non-free-firmware

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.

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

Upgrade to Debian 12 “Bookworm” from Debian 11 “Bullseye”

Proceed with the full system upgrade using the apt full-upgrade command. Keep an eye on the screen for notifications and prompts during the process, and reboot the system once completed.

sudo apt full-upgrade
sudo reboot

Cleaning up Obsolete Packages

After upgrading, remove obsolete packages from your Debian 12 system using the following command.

sudo apt --purge autoremove