Debian 12 (Bookworm) → Debian 13 (Trixie) Upgrade Guide

Debian 12 (Bookworm) → Debian 13 (Trixie) Upgrade Guide

Debian 13 “Trixie” has been stable since August 9, 2025. It ships kernel 6.12 LTS, Python 3.13, GCC 14.2, and is supported until 2028 (LTS to 2030). Debian 12 is now oldstable.

Only the 12 → 13 jump is supported. There is no clean downgrade path back to bookworm — recovery from a failed upgrade means restoring a backup or snapshot.


1. Pre-Upgrade Checklist

Back up first. At minimum: /etc, /home, any web roots, databases, and a package list.

# Save the installed package list
dpkg --get-selections > ~/packages-bookworm.txt

# Back up /etc
sudo tar czf ~/etc-backup-$(date +%Y%m%d).tar.gz /etc

If the machine is a VM, take a full snapshot instead — it’s the fastest rollback.

Confirm you’re actually on Debian 12:

cat /etc/debian_version     # should show 12.x
cat /etc/os-release | head -3

Check free disk space — have at least 5 GB free on /:

df -h /

Fully update the current system:

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

Reboot if a new kernel was installed.

Note any third-party repos (in /etc/apt/sources.list.d/) — these may not have trixie packages yet. Consider disabling them for the upgrade and re-enabling after:

ls /etc/apt/sources.list.d/

2. Point Repositories at Trixie

Replace every occurrence of bookworm with trixie:

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

Verify the result — /etc/apt/sources.list should look like:

deb http://deb.debian.org/debian trixie main non-free-firmware
deb http://deb.debian.org/debian trixie-updates main non-free-firmware
deb http://security.debian.org/debian-security trixie-security main non-free-firmware

Then refresh:

sudo apt update

Fix any errors here before proceeding — a broken source mid-upgrade is much worse.

3. Run the Upgrade (Two Stages)

Stage 1 — minimal upgrade (updates existing packages without pulling in new ones; reduces the chance of dependency deadlock):

sudo apt upgrade --without-new-pkgs

Stage 2 — full upgrade (new dependencies, new 6.12 kernel, removal of obsolete packages):

sudo apt full-upgrade

Notes for the interactive prompts:

  • Config file questions (keep local version vs install maintainer's version): if you customized the file (e.g., Apache/nginx configs, php.ini), keep the local version, then diff against the .dpkg-dist file afterward.
  • Services will ask to restart — allow it.
  • Do this from console access if possible; SSH usually survives, but a stuck dpkg prompt over a dropped SSH session is painful. Running inside tmux or screen is cheap insurance.

4. Clean Up and Reboot

sudo apt --purge autoremove
sudo apt autoclean
sudo reboot

5. Verify

cat /etc/debian_version    # should show 13.x
uname -r                   # 6.12.x kernel
python3 --version          # Python 3.13.x

Check that critical services came back:

systemctl --failed

6. Post-Upgrade Tasks

Recreate all Python venvs

Trixie moves system Python from 3.11 to 3.13. Every venv on the system built against 3.11 will break (their pyvenv.cfg and symlinks point at the old interpreter). For each project:

cd /path/to/project
source venv/bin/activate && pip freeze > requirements.txt && deactivate  # if not already saved
rm -rf venv
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

(Silver lining: no more pyenv needed to get past 3.11.)

Modernize apt sources (optional)

Trixie supports the new deb822 sources format. To convert:

sudo apt modernize-sources

Re-enable third-party repos

Update any disabled .list files to their trixie equivalents (or check whether the vendor supports trixie yet), then sudo apt update.

Diff config files

Look for .dpkg-dist / .dpkg-old files and merge any needed changes:

sudo find /etc -name "*.dpkg-*"

Rollback Reality Check

apt cannot downgrade trixie → bookworm. If the upgrade fails badly, the options are: restore the snapshot/backup, or reinstall Debian 12 and restore /etc + data. Keep the backup/snapshot for at least a day of normal operation before deleting it.


Debian 12 → 13 · trixie stable since 2025-08-09 · last updated July 2026