Upgrade Debian 11.7 to 12.0

Complete guide for Upgrading your Debian 11 Server or Desktop to Debian 12 (Bookworm).

Prerequisites

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.

  1. Edit the sources list:

    sudo nano /etc/apt/sources.list
  2. Replace all instances of bullseye with bookworm. Also, non-free component has been split into non-free and non-free-firmware.

    Example sources.list for 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
  3. Save and exit (Ctrl + O, Enter, Ctrl + X).

Step 3: Run the Upgrade

  1. Update package lists with new sources:

    sudo apt update
  2. Perform a minimal upgrade first (to avoid conflicts):

    sudo apt upgrade --without-new-pkgs -y
  3. Perform the full distribution upgrade:

    sudo apt full-upgrade -y

    During 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

  1. Restart your system:

    sudo reboot
  2. Verify the new version:

    hostnamectl
    # or
    cat /etc/debian_version

    Should 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.

User