Debian

How to Upgrade Debian 12 to Debian 13 Trixie

Debian 12 left full security support on July 11, 2026. A Bookworm server now lives on the LTS team’s updates until June 2028, and only on five architectures. Moving it to Debian 13 Trixie is still an apt job rather than a reinstall, but two things have changed since Trixie launched in August 2025. APT itself carried a download verification bug that DSA-6607 fixed in November, and the 13.8 point release raised the Secure Boot generation in Debian’s signed GRUB. Both land on your machine during the upgrade, and both are easy to confirm once you know where to look.

Original content from computingforgeeks.com - post 88866

This guide explains each step of the upgrade and why it comes in that order: patching Bookworm first, switching deb822 sources, the minimal upgrade, the full upgrade, and the checks afterwards, including how to read the GRUB SBAT generation off the EFI partition. The behavior described here was checked against Debian 13.8 in November 2026, on a Debian 12 cloud VM with Secure Boot on that we upgraded end to end, so every output below comes from that box.

Prerequisites

Before touching apt, get the machine into a known-good state. The upgrade itself is predictable, while recovering a half-applied one is slow, so the list below is mostly about giving yourself a way back:

  • A Debian 12 (Bookworm) system: server, desktop or VM. The flow is the same on bare metal because apt does all the work.
  • Root or sudo access: every package step needs it.
  • Disk headroom: at least 10 GB free on / and 500 MB on /boot. Our full upgrade alone downloaded 115 MB and used another 123 MB of disk.
  • Console access: a serial or web console for remote servers. sshd keeps running through the upgrade, but your session can drop mid-run, and that is easier to recover when you can see the machine.
  • A snapshot or backup: a cloud or Proxmox snapshot on a VM, a restic or borgbackup run of /etc and application data on bare metal.

If this is the first release upgrade you run on this box, skim the upgrade chapter of the Debian 13 release notes first. It is the source for the minimal-then-full order this guide follows, and its “issues to be aware of” chapter takes five minutes that can save an hour later.

What the starting point should look like

Confirm the release, the kernel and the apt version before anything else. Running these steps against Debian 11 or a box that was already moved makes the rest fail in confusing ways, and the apt version tells you whether the tool that is about to drive the upgrade is the patched one:

cat /etc/os-release | head -5
uname -r
cat /etc/debian_version
apt --version
mokutil --sb-state

Our VM started on Debian 12.15 with the 6.1 kernel series and Secure Boot enabled:

Debian 12.15 Bookworm before the upgrade: kernel 6.1.0-56, apt 2.6.2 and Secure Boot enabled

The line to check is apt 2.6.2. The bug behind DSA-6607 (CVE-2026-109518) also affects Bookworm, where the LTS team fixed it in 2.6.2 through DLA-4880-1, and the Debian security tracker still lists 2.6.1 as vulnerable. That matters here because the Bookworm apt is the one that downloads the first few hundred Trixie packages. If mokutil is missing, sudo apt install mokutil adds it, and a machine that prints SecureBoot disabled can skip the SBAT section further down. Output that already says trixie means the machine has been moved, so stop here.

Why Debian 12 has to be fully patched first

The release notes require the upgrade to start from a fully updated Bookworm, because any half-applied update turns into a dependency conflict once the Trixie indexes arrive. Patching first also brings apt to 2.6.2, which closes the download verification bug before apt fetches anything from the new suite:

sudo apt update
sudo apt upgrade
sudo apt full-upgrade

Clear what that left behind and reboot, even when nothing says a reboot is required:

sudo apt --purge autoremove
sudo apt clean
sudo reboot

The reboot makes the running kernel match the one on disk, so any problem you see after the release upgrade belongs to Trixie and not to a Bookworm kernel that was replaced but never loaded. One thing we learned the hard way on the lab VM: sudo reboot over SSH can take half a minute to tear the session down, and sshd keeps accepting logins during that window. Wait until uptime shows the box has really restarted before you carry on, or the next step may run on a machine that is about to go down.

Which packages can stall the upgrade

Packages from outside the Debian archive (Docker, PostgreSQL PGDG, Grafana, Node.js, a cloud vendor’s agents) are the usual reason a release upgrade stalls, because their repositories may only publish a bookworm suite. List them before you change anything:

apt list '?narrow(?installed, ?not(?origin(Debian)))' 2>/dev/null

On our cloud VM the list held seven Google packages (the guest agent, OS Login, the OS Config agent and the Cloud CLI), all from packages.cloud.google.com. Google already publishes -trixie suites for both repositories, so we let the source rewrite below switch them and they upgraded with everything else. For each package on your own list, check whether the vendor ships a Trixie suite. If it does, rewrite it with the Debian sources; if it doesn’t, remove the package now and reinstall it after the upgrade, which is what the release notes recommend.

Then look for holds. A hold on glibc, systemd or the kernel stops the upgrade with dependency errors that never mention the hold:

sudo apt-mark showhold

Empty output means nothing is held, which is what our VM printed. If a package shows up, release it with sudo apt-mark unhold followed by the package name, and run the check even on machines you built yourself, because configuration management tools set holds quietly.

How to back up and switch the APT sources

The switch is a rewrite of every suite name from bookworm to trixie, so keep a copy of the originals first. Copy both the legacy file and the sources.list.d directory, because current Debian 12 images keep their real sources in a deb822 file there:

sudo mkdir -p /root/apt-backup-$(date +%F)
sudo cp -a /etc/apt/sources.list /root/apt-backup-$(date +%F)/ 2>/dev/null || true
sudo cp -a /etc/apt/sources.list.d /root/apt-backup-$(date +%F)/

The || true keeps the first copy from failing on systems that have no /etc/apt/sources.list. Our VM had one, but it held only a comment pointing at debian.sources. Now rewrite the suites in all three places a source can live, which covers the main suite, updates, backports and security in one pass:

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

Print the files to confirm the result:

cat /etc/apt/sources.list.d/debian.sources
cat /etc/apt/sources.list.d/*.list

Every Suites: line in the deb822 file should now read trixie, trixie-updates, trixie-backports or trixie-security, and the third-party lines changed with them:

deb822 debian.sources and a third-party google-cloud.list switched from bookworm to trixie

The blanket sed is the reason the vendor check came first. It rewrote google-cloud.list too, which worked only because Google publishes those suites. A vendor that doesn’t would leave you with a 404 on the next step, so disable that file now rather than let it break apt update.

What apt update against Trixie should report

Pulling the new indexes is the first point where a broken repository shows itself. Refresh them, then ask apt which version of itself it is about to install:

sudo apt update
apt-cache policy apt | head -4

Our VM fetched 30 MB of indexes and reported 312 upgradable packages, with apt 3.0.4 as the candidate:

apt update against the trixie repositories with 312 upgradable packages and apt 3.0.4 as the candidate

Your package count will differ with what the machine runs. The candidate line is the one to read. Since the 13.8 point release, the main trixie suite and trixie-security both carry the fixed apt, so a candidate of 3.0.3 means the security source is missing and the mirror you use is behind. Fix that before you go on. A NO_PUBKEY or a “changed its Suite value” error belongs to the troubleshooting section below.

Why the minimal upgrade runs first

The minimal upgrade moves installed packages to their Trixie versions without installing anything new or removing anything. That keeps a full upgrade from tearing out a package you need while the dependency graph is still half old, half new, and it is the order the release notes give:

sudo apt upgrade --without-new-pkgs

Interactively, three kinds of prompt can stop the run. Each has a safe default:

  • Services to restart: answer Yes so daemons such as ssh and cron pick up the new libraries.
  • Configuration file conflicts: keep your local version with N unless you know the maintainer’s default is what you want, then diff the two afterwards.
  • Changelog or NEWS pager: press q and the upgrade carries on.

To answer those prompts up front, which suits automation and is how we ran it, pass dpkg the keep-local options:

sudo DEBIAN_FRONTEND=noninteractive \
  apt -y -o Dpkg::Options::='--force-confold' \
         -o Dpkg::Options::='--force-confdef' \
         upgrade --without-new-pkgs

We prefixed it with time. It upgraded 204 packages in 1 minute 49 seconds and restarted ssh, exim4 and cron when glibc changed:

apt upgrade --without-new-pkgs upgrading 204 packages and keeping apt back during the Debian 12 to 13 upgrade

Read the “kept back” list before you worry about it. It held 108 packages, and apt itself was on it, along with GRUB, the kernel and the GnuPG tools. Those packages need new dependencies (apt 3.0 pulls in libapt-pkg7.0 and sqv), which is exactly what the minimal pass refuses to install. So after this step the machine is still running Bookworm’s apt and Bookworm’s GRUB, and /etc/debian_version already says 13.8. That mixed state is normal, but it is not a place to stop.

What the full upgrade changes

The full upgrade installs the new dependencies, removes what Trixie replaced, and brings in the 6.12 kernel, apt 3.0 and the new GRUB. Run it inside tmux or screen on a remote server:

sudo apt full-upgrade

We ran it with the same non-interactive options as the minimal pass. It upgraded 108 packages, installed 74 new ones and removed 26, and the dpkg part finished in about 1 minute 40 seconds. Our SSH session, though, returned to the prompt while udev was still unpacking, with no error, and the output stopped there. apt carried on and finished, which we only knew from its own log. Read the end of that run from the log. It also holds earlier runs and carriage returns, so find the start time of the last run with grep 'Log started' /var/log/apt/term.log | tail -1 and print from there. Ours started at 18:44:46:

sudo sed -n '/18:44:46/,/Log ended/p' /var/log/apt/term.log | tr -d '\r' | grep -v '^$' | tail -16

The capture shows the full upgrade’s summary and its last 16 log lines:

apt full-upgrade to Debian 13 reinstalling GRUB for i386-pc and x86_64-efi and building the 6.12 initramfs

Two lines matter here. The Installing for x86_64-efi platform line is where the new signed GRUB is written to the EFI partition, and that step is what changes the SBAT generation we check later. On a cloud image the grub-cloud-amd64 trigger runs it for both BIOS and EFI; on an installer-built system the grub-efi-amd64 or grub-pc package does the same job. The last line, Log ended, is your proof that dpkg finished. If your session dropped and that line is missing, apt is still running or was killed, so check with pgrep -a dpkg and sudo dpkg --audit before you do anything else.

Remove obsolete packages and reboot

Trixie renames and supersedes a lot of Bookworm libraries, and the full upgrade leaves the old ones installed. Clear them and the downloaded archives:

sudo apt --purge autoremove
sudo apt clean

On our VM autoremove removed 30 packages and freed 64.9 MB, about half of them Python packages, including the 3.11 runtime that Trixie’s Python 3.13 replaces. The output also shows apt 3.0’s new layout, with a REMOVING: block and a Summary: line in place of the old sentences, which is a quick way to tell the new apt is the one running. Now reboot into the new kernel:

sudo reboot

As with the Bookworm reboot earlier, confirm with uptime that the machine really restarted before you run the checks below, or you may be reading the old kernel.

How to confirm the upgrade worked

After the reboot, check the release, the running kernel, the apt version and the overall system state in one go:

cat /etc/os-release | head -6
uname -r
cat /etc/debian_version
apt --version
systemctl is-system-running
mokutil --sb-state

Our VM came back on Debian 13.8 with the 6.12 kernel, apt 3.0.4 and every unit healthy:

Debian 13.8 Trixie after reboot: kernel 6.12.118, apt 3.0.4, system running with Secure Boot enabled

Trixie’s /etc/os-release also carries a DEBIAN_VERSION_FULL line, which Bookworm’s didn’t, so scripts no longer need to read /etc/debian_version for the point release. If systemctl is-system-running prints degraded instead of running, run systemctl --failed to see which unit broke. The exact kernel build depends on the day you upgrade, but the apt line should read 3.0.4 or later on any system upgraded since the point release.

The full upgrade kept the Bookworm kernel as a fallback, which is what you want for the first boots. Once Trixie has run cleanly for a week, list the kernel images and remove the old one:

dpkg --list | grep linux-image

Ours listed linux-image-6.1.0-56-cloud-amd64 next to the new image. Remove that package by name with sudo apt purge when you are confident in the new kernel, because autoremove alone does not always pick up the last Bookworm kernel.

What the GRUB SBAT generation tells you after the upgrade

SBAT is how shim refuses known-vulnerable boot loaders without Microsoft revoking Debian’s signing key. Every signed GRUB carries a generation number in an .sbat section, and shim keeps a minimum generation in a UEFI variable called SbatLevel. A GRUB below that minimum doesn’t boot with Secure Boot on. Debian 13.8’s grub2 fixed a Secure Boot bypass (CVE-2026-97876) and several use-after-free bugs, and raised the generation, which you can read straight off the EFI partition. This is what our VM showed before the upgrade:

sudo grep -a -o 'grub,[0-9]*,Free Software Foundation' /boot/efi/EFI/debian/grubx64.efi
sudo grep -a -o 'grub\.debian,[0-9]*,Debian,grub2,[^,]*' /boot/efi/EFI/debian/grubx64.efi
mokutil --list-sbat-revocations

Bookworm’s GRUB reported generation 5, and the revocation level shim had applied was also grub,5:

Debian 12 signed GRUB reporting SBAT generation grub,5 and the shim revocation level grub,5

The same commands after the upgrade, with the package versions added, show what moved:

dpkg-query -W -f='${Package} ${Version}\n' apt grub-efi-amd64-signed shim-signed

The GRUB on the EFI partition now reports grub,7, while shim’s revocation level is still grub,5. The second line, grub.debian, is Debian’s own vendor generation, and it stayed at 5, so compare the grub, line only:

Debian 13.8 signed GRUB on the EFI partition reporting SBAT generation grub,7 while shim revokes below grub,5

Read the two numbers together. The GRUB generation is what your boot loader carries; the revocation level is the floor shim enforces. Today the floor is 5, so both the old and the new GRUB boot, and nothing changes on the first reboot.

The point of the 13.8 change is the next step: once a shim update applies a revocation for GRUB generations below 7, a GRUB that still reports 5 stops booting with Secure Boot on. That includes the GRUB on older install media and any Bookworm system you never upgraded. On physical hardware SbatLevel lives in the firmware rather than on the disk, so restoring a disk image doesn’t undo it either; on a VM it depends on where the hypervisor keeps the UEFI variables. If the first command still prints grub,5 on a Trixie machine, the GRUB on the EFI partition is stale: run sudo apt full-upgrade, confirm grub-efi-amd64-signed is installed at its Trixie version, and check that the EFI partition is mounted at /boot/efi so the next GRUB update lands there. For what else Trixie brings beyond the boot chain, see our Debian 13 Trixie features and installation guide.

Troubleshooting common upgrade failures

Most failed upgrades trace back to a source or a held package, not to Debian itself. These are the errors worth knowing by their exact wording.

apt update fails with “changed its ‘Suite’ value from ‘stable’ to ‘oldstable'”

This comes from a Bookworm machine that has not refreshed its indexes since Trixie became stable. The Bookworm Release file now says oldstable, and apt makes you accept that change explicitly. Accept it once, then carry on with the upgrade:

sudo apt update --allow-releaseinfo-change

Sources that say stable instead of a codename are a separate trap, because they moved to Trixie on release day without anyone editing them. Always name the codename in your sources so the upgrade happens when you choose.

apt –version still reports 3.0.3 after the upgrade

That machine is missing the DSA-6607 fix. The bug needs a non-zero Acquire::Retries, which has defaulted to 3 since Debian 12, so default installs are exposed. Per the advisory, a man-in-the-middle attacker can replace a package after it has been verified, so treat an unpatched apt as a real exposure. Check that a trixie-security suite is in your sources and that your mirror is current, then upgrade apt:

apt-cache policy apt
sudo apt update
sudo apt full-upgrade

apt changelog apt should then open on an entry naming CVE-2026-109518 under “Download verification bypass”.

Third-party repo has no trixie release (Docker, Grafana, Kubernetes)

apt update prints a 404 or “does not have a Release file” for that one source. Most major vendors publish a Trixie suite now. Where one doesn’t, comment out its file in /etc/apt/sources.list.d/ and re-enable it once the vendor catches up. Never run the upgrade with an apt error still on screen, because the dependency solver works from whatever indexes it has and may hold back or remove that vendor’s packages.

The SSH session drops in the middle of the upgrade

It happened on our VM during the full upgrade. Log back in and find out whether dpkg is still working before you touch anything:

pgrep -a dpkg
sudo dpkg --audit
sudo tail -5 /var/log/apt/term.log

A running dpkg means wait. No dpkg, no audit output and a Log ended line mean the run finished. If dpkg was killed halfway, sudo dpkg --configure -a followed by sudo apt full-upgrade resumes it. Running the upgrade inside tmux avoids the guesswork, and with tmux attach you see any prompt that was waiting for an answer.

Error: “The following packages have unmet dependencies”

This usually traces back to a held package or a third-party repo conflict. Check holds first, then ask apt where it wants the named package to come from:

sudo apt-mark showhold
apt-cache policy package_name
sudo apt install -f

If apt can’t resolve it, remove the conflicting package and reinstall it after the upgrade, rather than pinning an old version that will block the next update too.

Boot fails after the reboot

Pick the old kernel from the GRUB menu (Advanced options for Debian GNU/Linux). If it boots, the 6.12 kernel has a driver problem with your hardware, so check dmesg and report it. If GRUB itself never appears on a Secure Boot machine, the firmware refused the boot loader, and the SBAT checks above are the first place to look from rescue media. If neither kernel boots, you need that rescue media or the snapshot from the prerequisites.

What Debian 13 changes on an upgraded box

An upgraded server behaves like a fresh Trixie install in most respects, and the Debian 13 installation walkthrough and the checklist of things to do after installing Debian 13 both apply to it. These are the changes our VM’s upgrade output made visible:

  • Kernel 6.12 LTS: replaces the 6.1 series, and Debian keeps it for the life of Trixie, taking upstream stable fixes through point releases.
  • Python 3.13: is the default python3, and autoremove takes Python 3.11 away, so virtualenvs built on 3.11 need rebuilding.
  • APT 3.0: prints grouped, coloured summaries and verifies signatures with sqv, which the full upgrade installed as a new package.
  • OpenSSH 10: the upgrade logged “Finishing upgrade from pre-9.8 monolithic sshd”, because sshd is now split into separate binaries, so restart-heavy SSH tooling is worth retesting.

If Docker or a Python application runs on the box, retest it on purpose rather than assume it survived. The Docker CE on Debian 13 guide covers switching its repository to the Trixie suite, and Python 3.13 on Debian 13 covers rebuilding environments. The same release-upgrade discipline carries over to other systems, as in our FreeBSD 14 to 15 upgrade.

Why rolling back to Debian 12 means a restore

apt has no supported downgrade from Trixie to Bookworm. Once the full upgrade has replaced glibc and systemd, pinning the old suite only produces a system that is neither release. The supported way back is the snapshot or backup you took before starting, and failing that, a fresh Debian 12 install with /etc and your data restored on top.

Two details make even the restore a weaker way back than it used to be. Bookworm is on LTS now, so a restored box gets security fixes only until June 30, 2028 and only on amd64, arm64, i386, armhf and ppc64el. And on Secure Boot hardware the SBAT floor is kept in firmware, not in the snapshot, so a future revocation of GRUB generation 5 would stop a restored Bookworm system from booting until it gets a newer GRUB. Our advice is simple: take the snapshot, run the upgrade, let the server work for a full day, and only then delete the snapshot, treating it as a way back for that day rather than a long-term plan.

Keep reading

Install Samba on Debian 13 / 12 and Create a File Share Debian Install Samba on Debian 13 / 12 and Create a File Share Backup and Restore Linux Systems with Timeshift Debian Backup and Restore Linux Systems with Timeshift Install KVM on Debian 13 / Debian 12: Complete Guide KVM Install KVM on Debian 13 / Debian 12: Complete Guide Moonfin for Jellyfin: Moonbase Plugin, Web App and Desktop Setup Debian Moonfin for Jellyfin: Moonbase Plugin, Web App and Desktop Setup Install Wiki.js 3 on Debian 13 and Ubuntu 26.04, Migrate from 2.x Containers Install Wiki.js 3 on Debian 13 and Ubuntu 26.04, Migrate from 2.x Install Zammad Helpdesk on Debian 13 (Trixie) Debian Install Zammad Helpdesk on Debian 13 (Trixie)

Leave a Comment

Press ESC to close