How to upgrade Debian 12 (bookworm) to Debian 13 (trixie)

Upgrade a Debian 12 server to Debian 13 in place, the way the release notes describe, with a snapshot to fall back on and checks before and after.

Tested on Debian 12 Oldstable, Debian 13 Stable

Before you start

  • A server running Debian 12
  • Root or a user with sudo
  • A recent backup or snapshot
  • About 2 GB of free disk space

To upgrade Debian 12 to Debian 13, bring bookworm fully up to date, change bookworm to trixie in your apt sources, then run apt update, apt upgrade --without-new-pkgs and apt full-upgrade, and reboot. Take a snapshot or backup first: there is no supported way back down.

Those are the steps from the Debian 13 release notes, which are worth skimming for the packages you run. We ran the whole upgrade on a Debian 12 container with nginx, OpenSSH and cron installed, ending on Debian 13.7 with all three running. A container doesn't boot a kernel of its own, so the reboot step was not part of our test.

Before you start

  1. Take a snapshot or backup. If the upgrade goes wrong, restoring is far quicker than repairing.

  2. Check disk space. df -h / should show at least 2 GB free. Free some up if not.

  3. Use tmux or screen. If your SSH connection drops mid-upgrade, the upgrade carries on and you can reattach:

    bash
    sudo apt install -y tmux
    tmux new -s upgrade

    If you're disconnected, log back in and run tmux attach -t upgrade.

  4. Note third-party repositories. Anything in /etc/apt/sources.list.d/ besides Debian's own (Docker, PostgreSQL, Node.js) needs its own trixie version. Check each vendor supports Debian 13 before you start.

Bring Debian 12 fully up to date

bash
sudo apt update
sudo apt full-upgrade
cat /etc/debian_version

Reboot if a new kernel was installed. Then check for problems that would get in the way:

bash
sudo dpkg --audit
apt-mark showhold

Both should print nothing. dpkg --audit lists half-installed packages (fix them with sudo dpkg --configure -a); showhold lists packages pinned at their version, which can block the upgrade (sudo apt-mark unhold PACKAGE).

Switch apt to trixie

Debian's sources live either in /etc/apt/sources.list (the classic one-line format) or in /etc/apt/sources.list.d/debian.sources (the newer format). See which you have:

bash
grep -rn bookworm /etc/apt/sources.list /etc/apt/sources.list.d/ 2>/dev/null

Replace bookworm with trixie in every Debian line, including bookworm-updates and bookworm-security:

bash
sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/debian.sources
sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list    # if you have this file

Leave third-party repositories alone for now, or disable them; switch each one to its trixie version after the upgrade.

Check it worked

bash
grep -rn trixie /etc/apt/sources.list /etc/apt/sources.list.d/ 2>/dev/null
sudo apt update

The Suites: (or deb) lines now say trixie, trixie-updates and trixie-security, and apt update finishes without errors.

Run the upgrade

The release notes do it in two stages. First a minimal upgrade, which doesn't install or remove packages:

bash
sudo apt upgrade --without-new-pkgs

Then the full upgrade:

bash
sudo apt full-upgrade

It downloads and installs a lot of packages; how long it takes depends on how many you have installed. Along the way, it may ask:

  • Whether to keep a configuration file you changed (Configuration file '/etc/ssh/sshd_config' ... What would you like to do about it?). Answering N (keep your version) is the safe default. Press D first to see the difference. If you put your SSH settings in /etc/ssh/sshd_config.d/, as our SSH guides do, the main file is unchanged and there's no question.
  • Whether to restart services automatically. Answer yes.

When it finishes, reboot into the new kernel:

bash
sudo reboot

Check the upgrade worked

Log back in, then:

bash
cat /etc/debian_version
grep PRETTY_NAME /etc/os-release
uname -r
systemctl --failed

You should see 13.x, Debian GNU/Linux 13 (trixie) and a 6.12 kernel, and systemctl --failed should list no units. Then check your own services one by one (systemctl status nginx, open the website, connect to the database).

Clean up

Remove packages that bookworm needed and trixie doesn't:

bash
sudo apt autoremove --purge

trixie's apt (version 3.0) can convert a classic sources.list into the newer format:

bash
sudo apt modernize-sources

It keeps a .bak copy of the old file. Now switch your third-party repositories to their trixie versions and run sudo apt update && sudo apt upgrade.

Troubleshooting

The SSH connection dropped during the upgrade. Log in again and tmux attach -t upgrade. If you didn't use tmux, run sudo dpkg --configure -a and then sudo apt full-upgrade again to finish.

E: The repository '... bookworm ... Release' does not have a Release file or similar after the switch. A third-party repository has no trixie version, or still points at bookworm. Disable that file (rename it to end in .disabled) and continue.

dpkg: error processing package .... Run sudo dpkg --configure -a, then sudo apt full-upgrade. The package named in the error usually has a note in the release notes.

Old SSH keys stop working. OpenSSH 10 in trixie no longer supports DSA keys (ssh-dss). Switch to an Ed25519 key, as in use SSH keys, before you upgrade.

The server doesn't come back after the reboot. Use the serial console to see where boot stopped, or revert to your snapshot.

Next steps

Doing it on VPSNine

Take a snapshot in the panel before you start; reverting to it takes a minute and undoes the whole upgrade. If you'd rather start clean, order a new server on Debian 13, move your data, and cancel the old one. Debian 12 stays available for setups that need it. See plans.

Be first when orders open

Join the waitlist and we'll send you one email when VPSNine launches. Pick a plan if you already know which one you want, and we'll size the first servers around it.

  • One email, on launch day
  • Monthly or yearly, no lock-in
  • 14-day money-back guarantee