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

Debian 13 Trixie upgrade

I’ve been upgrading my Debian 12 (bookworm) server fleet to Debian 13 (trixie).

Here is the successful process I ended up following for them all.

The process is essentially: update your package lists, switch the repository URLs from bookworm to trixie, and run the upgrade. Here is how I did it.

Step 1: Make sure your current system is fully up to date

Before switching repositories, bring your Debian 12 install to the latest patch level:

apt update
apt full-upgrade
apt autoremove
apt autoclean

Reboot afterwards so you are running the latest kernel before the upgrade:

reboot

Step 2: Backup your apt configuration

Good practice before changing anything:

cp -a /etc/apt /etc/apt.bak.$(date +%F)

If something goes wrong, you can restore the entire apt configuration from the backup.

Step 3: Switch repositories from bookworm to trixie

This is the core of the upgrade. Replace every occurrence of “bookworm” with “trixie” in your apt sources:

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

For any additional files in sources.list.d, handle them the same way:

find /etc/apt/sources.list.d -type f \( -name '*.list' -o -name '*.sources' \) -exec sed -i 's/bookworm/trixie/g' {} \;

Step 4: Update package lists

apt update

You will likely see key warnings at this point as you don’t have the latest keys yet.

Step 5: Refresh the keyring

apt install debian-archive-keyring
apt update

This installs the updated signing keys for the trixie repositories and clears the warnings.

Step 6: Perform the upgrade

I used a two-phase approach which is somewhat safer.

Phase 1: Upgrade existing packages without pulling in new dependencies:

apt upgrade --without-new-pkgs

Phase 2: Full upgrade — installs new packages, removes obsolete ones, and completes the distribution upgrade:

apt full-upgrade

This will take a while depending on your system and internet connection. Let it run.

Step 7: Cleanup

apt autoremove
apt autoclean

Step 8: Reboot

reboot

The kernel and systemd will have been upgraded, so a reboot is required.

Step 9: Verify

cat /etc/os-release
cat /etc/debian_version

You should see “Debian GNU/Linux 13 (trixie)” or similar. If you prefer the classic lsb_release output:

apt install lsb-release -y
lsb_release -a

Notes

If you are using a desktop environment or have third-party repositories (Docker, PostgreSQL, etc.), check that they have trixie-compatible entries in sources.list.d after the switch and, in case, update them accordingly.

As always, make sure you have a recent backup before upgrading a production system.

I hope you find this useful!

Leave a Reply

Your email address will not be published. Required fields are marked *