Debian upgrades have a reputation for being boring. apt full-upgrade, wait, reboot, done. That reputation was earned on servers running nothing but packages from the official archive — and almost no production server looks like that anymore. Add Docker’s repository, the PostgreSQL PGDG archive, NodeSource, a Grafana APT repo, and one vendor agent installed from a .deb, and a Trixie upgrade becomes an exercise in dependency resolution across five independent vendors who did not coordinate their release schedules with Debian’s.
The good news: Trixie is a genuinely well-behaved release. The 64-bit time_t transition is complete, the /usr merge requirement has been enforced for years, and the package set is unusually coherent. The bad news is that the failure modes have moved — they are now almost entirely about third-party repositories and configuration files that changed format, not about the base system itself.
This runbook covers what actually breaks, in the order it breaks, with commands you can run as-is.
TL;DR: Upgrade In Place Unless One of These Applies
In-place apt full-upgrade is the right choice for 90% of servers. Rebuild from scratch when the host carries more than two major-version leaps of accumulated configuration, when it runs a database you cannot afford to have offline for an hour, or when it is a hypervisor you can evacuate.
- In place: standard application servers, CI runners, monitoring nodes, web frontends.
- Rebuild: database primaries, hypervisors, anything with hand-edited packages or a decade of
/etcarchaeology. - Never: upgrade a machine you have not backed up, and never skip the third-party repo audit.
Debian 12 vs 13: What Actually Changed
| Component | Debian 12 (Bookworm) | Debian 13 (Trixie) | Upgrade impact |
|---|---|---|---|
| Kernel | 6.1 LTS | 6.12 LTS | Reboot required; check out-of-tree modules |
| Python | 3.11 | 3.13 | python3.11-* packages replaced; venvs must be rebuilt |
| PHP | 8.2 | 8.4 | Extensions renamed or dropped; PECL rebuild |
| PostgreSQL | 15 | 17 | Cluster is not auto-upgraded; pg_upgradecluster needed |
| systemd | 252 | 257 | Unit syntax mostly stable; new sandboxing defaults |
| OpenSSH | 9.2 | 10.0 | DSA keys rejected; old ciphers removed |
| GNOME | 43 | 48 | Desktop only; irrelevant on servers |
| APT | 2.6 | 3.0 | New solver, deb822 sources as default format |
| OpenSSL | 3.0 | 3.5 | Legacy provider still available but not default |
Two rows deserve emphasis. The PostgreSQL cluster on a Trixie host does not magically become version 17 — the postgresql-15 package remains installable, and upgrading the cluster is a separate, deliberate operation with pg_upgradecluster. And Python 3.13 means every virtualenv on the box is now pointing at a removed interpreter; rebuild them from lockfiles rather than trying to repair them.
Choosing Your Path
| Situation | Path | Reasoning |
|---|---|---|
| Single app server, config in Ansible | In-place apt full-upgrade | Fastest, and config drift is already controlled |
| Database primary with <1h downtime budget | Logical replica on Trixie, then switch | Avoids in-place cluster upgrade risk entirely |
| Hypervisor with live guests | Evacuate, rebuild, restore | Cheapest path to a known-good state |
| Long-lived pet server with manual edits | In-place, but with etckeeper first | You need a diff of every config change |
| Fleet of 50+ identical nodes | Rebuild from image, rolling replace | Deterministic; no snowflake divergence |
| Container host | In-place, then recreate containers | Containers isolate most runtime risk |
For a fleet, rebuilding is almost always cheaper than debugging 50 unique machines. For one server, in-place is almost always cheaper than rebuilding.
Pre-Flight Checks
Run these before touching sources.list. Each one catches a class of failure that is painful to diagnose mid-upgrade.
| |
That etckeeper commit is the single highest-value step in this entire guide. After the upgrade, git -C /etc log -p shows you exactly which configuration files the maintainers rewrote, which turns “why is nginx behaving differently” from an afternoon into a two-minute git diff.
The Upgrade Sequence
Do not combine the source change and the full upgrade into one command. Debian’s release notes are explicit about the two-phase approach, and skipping phase one is how you end up with 400 packages removed.
| |
--without-new-pkgs exists to make the failure surface small. If phase one fails, you are still on a Bookworm userland with Trixie package lists, and the fix is a normal dependency problem. If you jump straight to full-upgrade, a single unsatisfiable dependency can cascade into removing your bootloader.
After the reboot, verify before you celebrate:
| |
needrestart is the step people skip. A service still running against pre-upgrade shared libraries will behave unpredictably for days, and systemctl --failed will not tell you about it.
Third-Party Repositories: The Real Failure Mode
Every external repository must publish a Trixie suite before you run phase two. If it does not, you have three options, in order of preference: pin the old suite, disable the repo for the duration of the upgrade, or remove the package and reinstall after.
| |
The repositories that most often lag: Docker (usually fine, publishes trixie quickly), NodeSource (frequently one suite behind), Microsoft’s packages.microsoft.com (mixed), and small vendor agents distributed as .list files with a hardcoded codename. Audit every file in /etc/apt/sources.list.d/ against the list you captured in pre-flight.
One more trap: a repo that accepts trixie in its URL but serves Bookworm-built binaries. The upgrade succeeds, the package installs, and you spend the next week debugging a segfault. Check apt-cache policy <package> after the upgrade — if the installed version’s origin is a repository that has not published a Trixie suite, treat it as suspect.
Rollback and Recovery
There is no supported downgrade path. apt will let you pin versions and reinstall Bookworm packages, but a half-downgraded system is worse than a broken Trixie system. Plan for one of these instead:
- Snapshot or image the disk before starting. LVM thin snapshots, ZFS snapshots, or a hypervisor-level snapshot. This is the only true rollback.
- Keep the old kernel installed. If the new kernel fails to boot, GRUB still lists the Bookworm kernel, and you can boot it to diagnose.
- Keep a rescue shell open. A second SSH session, or a console session via the hypervisor, not a tmux pane on the machine you are upgrading.
- Do not reboot until phase two completes. A reboot mid-
full-upgradeis how machines become unbootable.
If the upgrade fails at phase one, the fix is dependency resolution: read the apt output, identify the package with the unsatisfiable constraint, and either remove it or pin its Bookworm version. If it fails at phase two, restore the snapshot. The intermediate states are not worth rescuing.
For distribution-level context on how Debian’s upgrade compares with Leap, Elevate, and do-release-upgrade, our in-place Linux upgrade comparison covers the tradeoffs. If the machine you are upgrading is a Proxmox node, use the PVE 9 runbook instead — the ordering and the repository set are different. And if you mirror Debian packages internally, the Debian repository mirroring guide explains how to stage Trixie alongside Bookworm during the transition.
FAQ
Is Debian 13 stable enough for production in 2026?
Yes. Trixie was released in August 2025 and has had over a year of point releases and security updates. The base system is stable; the risk is concentrated in third-party repositories and in packages that changed major version, such as PHP and PostgreSQL.
Does the upgrade automatically migrate my PostgreSQL cluster to version 17?
No. The postgresql-15 package remains available in Trixie, and your existing cluster keeps running until you explicitly create a 17 cluster and run pg_upgradecluster 15 main. Plan that as a separate maintenance window with a verified pg_dump fallback.
What happens to my Python virtualenvs after upgrading?
They break. Debian 12 ships Python 3.11 and Trixie ships 3.13, so the interpreter path inside every virtualenv no longer exists. Rebuild each environment from its lockfile with uv sync or pip install -r requirements.txt rather than trying to patch the pyvenv.cfg path.
Can I downgrade if the upgrade goes badly?
Not cleanly. There is no supported downgrade path, and partially downgraded systems are less reliable than the broken upgrade. Use a disk snapshot, VM snapshot, or full image backup before starting; that snapshot is your rollback.
Do I need to remove third-party repositories before upgrading?
You need to either confirm they publish a Trixie suite or disable them for the duration. Leaving a Bookworm-only repository enabled during apt full-upgrade is the most common cause of dependency conflicts and accidental package removals.
How long does a Debian 12 to 13 upgrade take?
For a typical application server, 30 to 60 minutes including download, install, and reboot. Machines with large package sets, databases, or slow mirrors can take two hours. The reboot and post-upgrade verification usually take longer than the upgrade itself.
💰 想测试你的市场判断力?我用 Polymarket 做预测市场交易——这是全球最大的预测市场平台,从大选结果到技术监管时间线,什么都可以押注。和赌博不同,这是真正的信息市场:你懂的信息越多,胜率越高。我靠预测技术相关事件的走向已经赚了不少。用我的邀请链接注册:Polymarket.com