keepcalculator

06 Numbers and Powers

Debian 12 to 13 Upgrade: Safe Step-by-Step Guide

Card No. 06·65677 · Updated · Standard formula, shown below

This guide walks you through upgrading a Debian 12 Bookworm system to Debian 13 Trixie safely. You’ll update your package sources, perform the release upgrade, and handle common issues that arise during the process. The goal is a working Trixie system without losing data or breaking your current setup.

What You’ll Need

  • A Debian 12 Bookworm installation with a root or sudo user account.
  • A stable internet connection with sufficient bandwidth to download the new packages (typically 1–2 GB for a standard desktop).
  • At least 10 GB of free disk space (more if you have many packages installed).
  • A current backup of important files and configuration. Ideally, a full system backup or a snapshot of your virtual machine.
  • Approximately 30–60 minutes of uninterrupted time, depending on your hardware and network speed.

Step-by-Step

  1. Back up your system. Before any major upgrade, ensure you have a recent backup. At minimum, copy your home directory and key configuration files (e.g., /etc) to an external drive. If you’re using a virtual machine, take a snapshot.
  2. Update your current system. Open a terminal and run:
    sudo apt update
    sudo apt full-upgrade

    This ensures your Bookworm system is fully patched before the release upgrade. Reboot if a kernel update was applied.

  3. Check for held or broken packages. Run apt list --upgradable and apt-mark showhold. If any packages are held, either unhold them or note them for later. Also run dpkg --audit to check for broken packages; fix them before proceeding.
  4. Edit your sources.list. Open the file with a text editor:
    sudo nano /etc/apt/sources.list

    Replace all occurrences of bookworm with trixie. Also update any lines that refer to bookworm-updates and bookworm-backports to trixie-updates and trixie-backports. If you use files in /etc/apt/sources.list.d/, update those as well.

  5. Update the package lists. Run:
    sudo apt update

    This will fetch the package lists for Trixie. You may see warnings about missing keys or repositories; address them if they are critical (e.g., third-party repos).

  6. Perform the release upgrade. Run:
    sudo apt full-upgrade

    This is the core step. It will download and install all packages necessary to move from Bookworm to Trixie. You will be prompted to confirm the installation; review the list of packages to be removed and installed. Pay attention to any packages that will be removed—if something essential is being removed, you may want to cancel and investigate.

  7. Handle configuration file prompts. During the upgrade, you may be asked what to do with configuration files that have changed. Usually, it’s safe to keep the existing version (press N for “keep the old version”) unless you know the new version is required. Read the prompt carefully.
  8. Reboot. After the upgrade completes, reboot your system:
    sudo reboot

    This loads the new kernel and ensures all services start fresh.

  9. Verify the upgrade. After booting, check the OS version:
    cat /etc/os-release

    You should see VERSION="13 (trixie)". Also run apt update && apt full-upgrade again to ensure no leftover packages are pending.

  10. Clean up. Remove obsolete packages and old kernels with:
    sudo apt autoremove
    sudo apt autoclean

    This frees disk space and removes unneeded dependencies.

Common Mistakes

  • Skipping the backup. The most common and costly mistake. Always back up before a release upgrade.
  • Not updating Bookworm first. Upgrading from an outdated Bookworm can cause dependency conflicts. Always run full-upgrade on Bookworm first.
  • Forgetting third-party repositories. If you have added repos like Google Chrome or VirtualBox, they may not support Trixie yet. Disable them before the upgrade to avoid errors, then re-enable one by one after.
  • Using dist-upgrade instead of full-upgrade. They are equivalent in Debian, but full-upgrade is the recommended command for release upgrades.
  • Ignoring held packages. Held packages can block the upgrade. Unhold them temporarily or remove them.
  • Not rebooting after the upgrade. Some services may not restart correctly; a reboot is essential.

Tips

  • Use a wired internet connection if possible—it’s more stable for large downloads.
  • Run the upgrade from a terminal (Ctrl+Alt+F3) rather than a graphical session to avoid display issues.
  • Keep a note of any custom repositories you have; you’ll need to update them for Trixie.
  • If you have a lot of third-party packages, consider waiting a few weeks after Trixie’s release for them to catch up.
  • Use screen or tmux if you’re doing the upgrade over SSH to prevent a dropped connection from interrupting the process.

Troubleshooting

  • Upgrade fails with “unmet dependencies”. Run sudo apt --fix-broken install and then retry sudo apt full-upgrade. If it persists, check for held packages or obsolete third-party repos.
  • System boots to a black screen. This can happen due to graphics driver issues. Boot into recovery mode (hold Shift at boot) and reinstall the default drivers: sudo apt install --reinstall xserver-xorg-video-* or linux-image-amd64.
  • Network doesn’t work after upgrade. Check if NetworkManager or systemd-networkd is running: sudo systemctl status NetworkManager. If not, start it with sudo systemctl start NetworkManager and enable it.
  • Package manager is locked. If you see “Could not get lock /var/lib/dpkg/lock”, wait for other processes to finish or remove the lock file if no other apt process is running.
  • Rollback to Bookworm. If Trixie is unusable, you can restore from your backup, or if you didn’t back up, you can edit sources.list back to bookworm and run sudo apt update && sudo apt full-upgrade to downgrade (this is risky and not always possible).

Frequently Asked Questions

Is it safe to upgrade from Debian 12 to 13?

Yes, if you follow the official upgrade path, back up your data, and have time to troubleshoot. Debian releases are designed to be upgradable in place.

How long does the upgrade take?

Typically 30–60 minutes, but it depends on your internet speed and the number of installed packages. A minimal server may take less than 15 minutes.

Will my custom configurations be preserved?

Yes, configuration files in /etc are usually kept. However, some services may require you to accept new configuration changes; review prompts carefully.

Can I skip versions (e.g., from 11 to 13)?

No, Debian officially supports upgrading only one release at a time. You must go from 11 to 12, then 12 to 13.

What if I have a package not in the official repos?

Third-party packages may break. Check if the provider offers a Trixie version. If not, consider removing the package before the upgrade and reinstalling later.

Do I need to reinstall the system?

No, a release upgrade is designed to be done in place. A fresh install is only necessary if the upgrade fails catastrophically.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →