Skip to content

Debian upgrade cheat sheet

Upgrading from one major Debian version to another (in this case, Debian 12 “Bookworm” to Debian 13 “Trixie”) is a manual process. Debian does not automatically upgrade across major versions to ensure stability.

Prepare the system

Before switching repositories, ensure your current Debian 12 system is completely up to date and clean.

  1. Backup your data. Do not skip this. A failed upgrade can render the system unbootable.

  2. Update current packages:

    sudo apt update
    sudo apt upgrade
    sudo apt full-upgrade
    
  3. Remove unused packages to minimize conflicts:

    sudo apt autoremove
    

Update repository sources

You need to tell apt to stop looking at “bookworm” repositories and start looking at “trixie” ones.

  1. Edit the sources list:

    sudo vim /etc/apt/sources.list
    

    Note

    If your system uses the newer format, check inside /etc/apt/sources.list.d/debian.sources instead.

  2. Replace codenames:

    Change every instance of bookworm to trixie.

    • Find lines like: deb http://deb.debian.org/debian/ bookworm main
    • Change to: deb http://deb.debian.org/debian/ trixie main

    Also update the security suite:

    • From: bookworm-security
    • To: trixie-security.

    Tip

    You can do this automatically with sed (double-check the file afterwards):

    sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
    sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/*.list
    

Perform the upgrade

Now that the sources point to Debian 13, you perform the upgrade in two stages.

  1. Update the package lists:

    sudo apt update
    
  2. Minimal Upgrade (Step 1):

    This upgrades packages that can be upgraded without removing anything. It provides a smoother path than jumping straight to full-upgrade.

    sudo apt upgrade --without-new-pkgs
    
  3. Full Upgrade (Step 2):

    This performs the major version upgrade, installing new dependencies and removing conflicting old packages.

    sudo apt full-upgrade
    

    During this process, you will see prompts asking if you want to restart services automatically or keep existing configuration files. Generally, it is safer to keep your existing configuration files (the default option usually “N” or “Keep currently installed version”) unless you know for sure you want the new defaults.

Reboot and clean up

  1. Reboot:

    sudo systemctl reboot
    
  2. Verify Version:

    Once back up, check your version:

    cat /etc/debian_version
    
  3. Clean Up:

    Remove the old Debian 12 packages that are no longer needed.

    sudo apt autoremove
    sudo apt clean