Log inSign up

Upgrade a Debian server to the next stable release

Back up the server, bring Debian 12 fully up to date, then replace bookworm with trixie in every APT source file. Run sudo apt update, a minimal pass with sudo apt upgrade --without-new-pkgs, then sudo apt full-upgrade, and reboot. cat /etc/debian_version should then print 13.x. Do it inside tmux with a second SSH session open.

Topic: Server basics · Tested on: Debian 12 and 13 · Updated 2026-12-03

When should I upgrade from Debian 12?

Debian 13 (trixie) is the current stable release, and Debian 12 (bookworm) has moved to its long term support phase, which covers a smaller set of packages with security fixes until mid 2028. Upgrading during this window keeps your server on fully supported software without rushing. Debian supports upgrades from one major release to the next only, so a Debian 11 server must reach 12 first using the same method.

The process below is the one Debian documents in its release notes, condensed for a typical server. The same pattern applies to later releases: when the next stable version arrives, you will change trixie to its code name. Read the official release notes for the target version before you start, because they list the changes that need attention, such as removed packages or new defaults.

If the server has grown organically over years, consider the alternative of a fresh Debian 13 instance and a data migration; the migration tutorial shows the flow.

What backups do I need before starting?

Have at least one copy you can restore without the server itself. There are no snapshots on our platform, so plan one or both of these:

  • Turn on the daily backups add-on from the Backups tab a day or more ahead, so a recent backup exists; support restores it on request. See daily backups.
  • Copy configuration and data to another machine yourself.
sudo tar czf /root/etc-bookworm.tgz /etc /var/lib/dpkg /var/lib/apt/extended_states
dpkg --get-selections '*' > ~/package-selections.txt

The first archive contains the configuration and the package database, the second file lists every installed package. Add database dumps and application data, then pull everything to your computer or another server with rsync or scp. Confirm the copy is readable before going further.

How do I prepare the Debian 12 system?

Start from a clean, fully updated bookworm with nothing unusual pending:

sudo apt update
sudo apt full-upgrade
sudo apt autoremove --purge
sudo dpkg --audit
apt-mark showhold
df -h / /boot
cat /etc/debian_version

dpkg --audit must print nothing, and held packages should be released with sudo apt-mark unhold unless you have a reason. Reboot if a new kernel was installed. Look for packages that did not come from Debian, which are the usual troublemakers:

apt list '?narrow(?installed, ?not(?origin(Debian)))'

Note each third party source (Docker, Node.js, PostgreSQL, vendor tools) so you can update it to its trixie repository afterwards, or disable it for the upgrade and re-add it later.

How do I keep a safe connection during the upgrade?

There is no browser console on BitcoinVPS instances, so SSH has to stay available the whole time. Work inside a tmux session, keep a second SSH session open in another terminal, and record the upgrade so you can read what happened:

sudo apt install tmux
tmux new -s upgrade
script -a ~/upgrade-trixie.log

If the connection drops, log in again and run tmux attach -t upgrade; the upgrade keeps running in the meantime. The script command writes everything you see to a log file, which helps when you need to ask for advice. See tmux sessions for more about tmux.

How do I point APT at Debian 13?

Change the release name in every source file. Debian 12 servers keep sources either in the classic /etc/apt/sources.list or in the newer deb822 file /etc/apt/sources.list.d/debian.sources, so check both:

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

Replace the name in the Debian entries. The security suite follows the same pattern (bookworm-security becomes trixie-security), so a single substitution covers it:

sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
sudo sed -i 's/bookworm/trixie/g' /etc/apt/sources.list.d/debian.sources
grep -rn -E 'bookworm|trixie' /etc/apt/sources.list /etc/apt/sources.list.d/

Only run the sed line for the files that exist. Do not blindly change third party files: their vendors may not publish a trixie repository under the same path. Comment them out for now if unsure.

How do I run the upgrade itself?

Debian recommends two passes. The first upgrades what can be upgraded without installing anything new, the second completes the switch:

sudo apt update
sudo apt -o APT::Get::Trivial-Only=true full-upgrade
sudo apt upgrade --without-new-pkgs
sudo apt full-upgrade

The Trivial-Only line is a dry run that reports how much space the upgrade needs without changing anything. During the real passes you will see three kinds of questions:

  • a list of services to restart: accept the default
  • changed configuration files: keep your local version unless you know the new one is better, and view the difference with D first
  • news from apt-listchanges, if installed: read and quit with q

Keeping your version of /etc/ssh/sshd_config is especially important, since it holds your login settings. When the full upgrade finishes, reboot with sudo systemctl reboot.

How do I check and tidy up after the reboot?

Log in again and confirm the release, the kernel and the health of services:

cat /etc/debian_version
uname -r
systemctl --failed
journalctl -p err -b --no-pager | tail -n 30

Then remove what is no longer needed and modernize the source format with the new APT:

sudo apt autoremove --purge
apt list '~o'
sudo apt purge '~c'
sudo apt modernize-sources

~o lists obsolete packages that no repository offers any more; remove them if nothing depends on them. ~c matches packages that were removed but left configuration files. apt modernize-sources converts old style one line entries into deb822 files and keeps a backup of the originals. Finally, re-enable third party repositories with their trixie paths and run sudo apt update once more.

What if something fails during the upgrade?

Most failures leave dpkg half done but fixable over SSH. Let it finish its queue and try again:

sudo dpkg --configure -a
sudo apt -f install
sudo apt full-upgrade

If one package keeps failing, its maintainer script output in ~/upgrade-trixie.log names the reason, often a modified config or a third party package that conflicts. Remove the conflicting package, finish the upgrade and reinstall it from a trixie compatible source. If the server does not come back after rebooting, open a support ticket: the recovery route is a support restore of the daily backup, or a reinstall followed by restoring your own copy.

Questions about Upgrade Debian to a new major release

Can I upgrade from Debian 11 straight to 13?

No. Upgrade 11 to 12 first with the same steps, reboot, verify, and only then move from 12 to 13.

Should I use apt or apt-get for the upgrade?

Either works. The current release notes use apt, and the commands in this guide follow them.

How much free disk space is needed?

It depends on installed packages. The dry run with -o APT::Get::Trivial-Only=true full-upgrade prints the download and install size; keep a few gigabytes extra.

Will my Docker containers survive the upgrade?

Container data in volumes stays on disk. Update the Docker repository line to trixie, upgrade, and start the containers again with docker compose up -d.

Can I roll back to Debian 12?

Not in place. Downgrades are not supported, so the way back is a restore from backup, which is why the backup step comes first.