Upgrade Debian 11.7 to 12.0
Complete guide for Upgrading your Debian 11 Server or Desktop to Debian 12 (Bookworm).
Prerequisites
- Backup your data (Critical!).
- Ensure you have root access or sudo privileges.
- Ensure you have a stable internet connection.
Step 1: Update Existing System
Before upgrading, make sure your current system is fully up to date.
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove -y
Step 2: Update Sources List
You need to change the package repositories from bullseye to bookworm.
-
Edit the sources list:
sudo nano /etc/apt/sources.list -
Replace all instances of
bullseyewithbookworm. Also,non-freecomponent has been split intonon-freeandnon-free-firmware.Example
sources.listfor Debian 12:deb http://deb.debian.org/debian bookworm main contrib non-free non-free-firmware deb http://deb.debian.org/debian bookworm-updates main contrib non-free non-free-firmware deb http://security.debian.org/debian-security bookworm-security main contrib non-free non-free-firmware -
Save and exit (
Ctrl + O, Enter,Ctrl + X).
Step 3: Run the Upgrade
-
Update package lists with new sources:
sudo apt update -
Perform a minimal upgrade first (to avoid conflicts):
sudo apt upgrade --without-new-pkgs -y -
Perform the full distribution upgrade:
sudo apt full-upgrade -yDuring this process:
- Several services will restart.
- You may be asked if you want to restart specifically. Choose Yes.
- You may be asked about configuration files. If you haven't customized them, choose "Install the package maintainer's version". If you have, choose "Keep your currently-installed version".
Step 4: Reboot and Verify
-
Restart your system:
sudo reboot -
Verify the new version:
hostnamectl # or cat /etc/debian_versionShould show
12.x.
Step 5: Post-Upgrade Cleanup
Remove obsolete packages to free up space.
sudo apt --purge autoremove -y
sudo apt clean
Troubleshooting
"Firmware missing" errors
Debian 12 moved non-free firmware to a separate component. Ensure non-free-firmware is in your sources.list (as shown in Step 2).
SSH Disconnected
If upgrading a remote server, simple reboot is usually safe, but ensure you have console access (VNC/KVM) just in case network config changes break connectivity.