Upgrading a Debian 12 (Bookworm) server to Debian 13 (Trixie) over SSH only takes a few apt commands, but if you miss one check before rebooting, the server won't come back online.
When I upgraded our first headless Debian 12 server, the package installation finished without a single error. Before rebooting, I ran the udevadm check from the official Debian 13 release notes, and it told me our enp6s18 network interface would keep its name. Then I rebooted and got hit with No route to host. On boot, systemd v257 renamed enp6s18 to ens18 anyway, while /etc/network/interfaces was still looking for the old name.
On the next server upgrade, I pinned the network interface name to its MAC address before rebooting, and the machine came right back online over SSH on the first try without needing an out-of-band rescue console.
Regular security support for Debian 12 ended in July 2026 when it moved to LTS. Bookworm LTS runs until June 30, 2028, but it doesn't cover every package, and most third-party repos have already moved to Trixie. Here is the exact process I used to upgrade our Debian 12 server to Debian 13 over SSH.
Server Baseline
Here is the starting environment of the headless Debian 12 server before upgrade to 13.
- Operating System: Debian GNU/Linux 12.15 (Bookworm), minimal SSH server
- Starting OpenSSH: 1:9.2p1-2+deb12u10
- Network configuration:
/etc/network/interfaces(ifupdown) on interface enp6s18 - Final state after upgrade: Debian 13.7 (Trixie), kernel 6.12.113+deb13-amd64, zero failed systemd units
What Can Break a Remote SSH Upgrade to Debian 13
Before touching your APT sources, first attention on six changes in the Debian 13 release notes which affect remote servers.
The Bookworm OpenSSH lockout bug (Debian Bug #1109742 / #1110030): On older Bookworm openssh-server builds, sshd briefly stops accepting new connections while the package is being replaced. If your SSH connection drops mid-upgrade, you cannot reconnect. Updating Bookworm's openssh-server to 1:9.2p1-2+deb12u7 or newer before starting fixes this completely.
DSA SSH keys are removed: OpenSSH 9.8+ in Trixie disables ssh-dss keys at compile time. Switch any legacy DSA keys to Ed25519 or RSA before upgrading.
sshd ignores ~/.pam_environment: Move any environment variables stored there into ~/.bashrc or ~/.profile.
Silent network interface renaming: systemd v257 in Trixie uses the firmware's ACPI _SUN (Slot User Number) object and updated i40e driver rules, which can rename your primary NIC on the first boot into Trixie even when udevadm test-builtin predicts no change before rebooting.
/etc/sysctl.conf is no longer read: systemd-sysctl ignores /etc/sysctl.conf in Debian 13. Forwarding rules (net.ipv4.ip_forward = 1) or kernel hardening settings must live in /etc/sysctl.d/*.conf.
/tmp moves to tmpfs (RAM): After rebooting into Trixie, /tmp mounts in memory.
Run the Pre-Flight Audit on Debian 12
SSH into your Debian 12 server and check your Operating System point release, running kernel, architecture, /boot free space and installed openssh-server version using below command.
cat /etc/debian_version && uname -r && dpkg --print-architecture && df -h /boot && apt policy openssh-server
Output from our server:

Before moving ahead process check these three in above output:
First you must have architecture amd64 or arm64. If you see i386, stop here. Second you need at least 768 MB total size with 300 MB free space on /boot. Third, openssh-server version must be 1:9.2p1-2+deb12u7 or newer. Here it is 1:9.2p1-2+deb12u10. If your server is on an older build, run sudo apt update && sudo apt full-upgrade -y on Debian 12, then disconnect and reconnect your SSH session. So you are running on the patched daemon.
Next, verify your SSH keys:
cat ~/.ssh/authorized_keys
Confirm your keys start with ssh-ed25519 or ssh-rsa (if any key starts with ssh-dss, replace it before upgrading).
Confirm sudo Privileges
Check your user account belongs to the sudo group and that the sudo binary is installed:
groups && command -v sudo
If you see sudo in your groups and /usr/bin/sudo, jump straight to the Back Up Configuration and Audit Packages section.
On Debian servers where a root password was set during the initial installation, Debian skips installing sudo by default. If sudo is missing on your server, switch to root with su to install it, comment out any leftover installation media lines in /etc/apt/sources.list, and add your user to the sudo group.
su - -c "sed -i '/^deb cdrom:/s/^/# /' /etc/apt/sources.list && apt update && apt install -y sudo && usermod -aG sudo $USER"
If you had to run that command, log out of SSH and log back in now so your session picks up the new sudo group permissions.
Back Up Configuration and Audit Packages
APT does not support downgrading from Debian 13 back to Debian 12. If your server provider supports full disk snapshots or backups, take a snapshot before continuing.
Next, back up /etc, your dpkg package selections, and APT's extended states to your home directory and audit the system for broken packages, held packages or third-party repositories.
sudo tar -czf ~/etc-bookworm-backup-$(date +%F).tar.gz /etc && dpkg --get-selections '*' > ~/dpkg-selections-bookworm.txt && sudo cp /var/lib/apt/extended_states ~/apt-extended_states.bak && sudo dpkg --audit && apt-mark showhold && apt list '?narrow(?installed, ?not(?origin(Debian)))'
On a clean Debian 12 server, the output is just:
tar: Removing leading `/' from member names Listing... Done
If your server returns extra lines, resolve them before switching repositories:
Output from dpkg --audit: Repair any half-installed packages with sudo apt --fix-broken install.
Output from apt-mark showhold: Release held packages with sudo apt-mark unhold <package_name> so they do not block dependency resolution.
Third-party packages listed (such as Docker CE, Sury PHP, Grafana, Zabbix, or NodeSource): Disable their repository files in /etc/apt/sources.list.d/ during the OS upgrade, and re-enable their trixie equivalents once the upgrade finishes:
sudo mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.disabled
Also remove or comment out any bookworm-backports or proposed-updates entries.
Service-specific checks before upgrading:
MariaDB: Debian 13 upgrades MariaDB from 10.11 to 11.8. MariaDB 11.8 refuses to start if it detects dirty redo logs from an unclean 10.11 shutdown. Stop MariaDB cleanly before starting the upgrade and verify Shutdown complete in the journal:
sudo systemctl stop mariadb && sudo journalctl -u mariadb -n 20 --no-pager | grep -i "shutdown complete"
Dovecot and RabbitMQ: Dovecot 2.4 changed its config format, and RabbitMQ can't upgrade its database in place from Bookworm to Trixie. If you run either one, test their config changes before upgrading the OS.
Migrate Any Active /etc/sysctl.conf Settings
systemd-sysctl ignores /etc/sysctl.conf in Debian 13, check if your server has any active uncommented lines in that file.
grep -Ev '^\s*#|^\s*$' /etc/sysctl.conf
On our server, this returned nothing. If yours outputs active lines (such as net.ipv4.ip_forward = 1 on a WireGuard, Tailscale, or router server), move them into /etc/sysctl.d/99-local.conf now so they continue to load on reboot:
sudo tee /etc/sysctl.d/99-local.conf > /dev/null << 'EOF' net.ipv4.ip_forward = 1 EOF
Start a Protected tmux Session
Never run a remote release upgrade in a raw SSH shell. If your internet drops mid-upgrade, your SSH session dies and can take the running apt upgrade down with it. Install tmux and start a dedicated upgrade session:
sudo apt install -y tmux && tmux new -s upgrade
A green [upgrade] status bar will appear at the bottom of your terminal. Keep two rules in your mind while inside tmux:
- To leave the session running in the background, press Ctrl+b then d to detach. Do not type exit, which closes the shell and terminates the tmux session.
- If your SSH connection drops, SSH back into the server and run tmux attach -t upgrade.
Switch APT Sources to Trixie (deb822 Format)
Debian 13 ships APT 3.0, which moves away from the legacy one-line /etc/apt/sources.list file to structured deb822 .sources files under /etc/apt/sources.list.d/debian.sources.
Run this command to back up /etc/apt/sources.list (if present), create /etc/apt/sources.list.d/debian.sources pointing to the official trixie repositories, and confirm no active source files still reference bookworm:
[ -f /etc/apt/sources.list ] && sudo mv /etc/apt/sources.list /etc/apt/sources.list.bookworm.bak; sudo tee /etc/apt/sources.list.d/debian.sources > /dev/null << 'EOF' Types: deb URIs: https://deb.debian.org/debian Suites: trixie trixie-updates Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg Types: deb URIs: https://security.debian.org/debian-security Suites: trixie-security Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg EOF grep -rn bookworm /etc/apt/sources.list.d/ 2>/dev/null || echo "no bookworm left"
Output:
no bookworm left
Refresh APT and Dry-Run the Upgrade
Update the package list from the Trixie repos and run a quick test check to see how much disk space the upgrade needs:
sudo apt update && sudo apt -o APT::Get::Trivial-Only=true full-upgrade
Output from the server:
294 upgraded, 58 newly installed, 21 to remove and 0 not upgraded. Need to get 249 MB of archives. After this operation, 235 MB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation.
The E: Trivial Only specified... message at the end is expected and means apt calculated the upgrade and stopped without modifying the system. Confirm you have enough free disk space and that linux-image-6.12.113+deb13-amd64 (or newer), linux-sysctl-defaults, and systemd-cryptsetup appear under The following NEW packages will be installed.
Stage 1: Minimal System Upgrade
Debian's official procedure splits the upgrade into two stages. First, upgrade all packages that can be updated without installing new packages or removing existing ones.
sudo apt upgrade --without-new-pkgs -y
During Stage 1, you will encounter up to three interactive prompts:
First open prompt like below image and select yes.

Second, apt-listchanges news pager (ends with :): Press q to close the pager and continue.
Third, Modified configuration file prompts: If you customized files like /etc/ssh/sshd_config, then keep your currently installed version (N). If you overwrite the sshd_config file with the package maintainer's default file, your SSH port might be reset to 22, while your firewall could be blocking it. APT saves the new default file alongside yours with a .dpkg-dist suffix so you can compare them later.
Near the end of Stage 1, dbus prints Output:
Setting up dbus (1.16.2-2) ... A reboot is required to replace the running dbus-daemon. Please reboot the system when convenient.
Do not reboot yet. Proceed straight to Stage 2.
Stage 2: Full Distribution Upgrade
Now, we run apt full-upgrade without -y, So we can inspect the list of packages queued for removal before confirming.
sudo apt full-upgrade
Review the REMOVED: Before press Y, first check all packages. On a standard server, around 21 old Bookworm library packages (libssl3, libgnutls30, libnettle8, libpython3.11-stdlib, etc.) are removed as their 64-bit time_t (t64) replacements and Python 3.13 take over. Confirm no critical server daemons are listed for removal, then press Y.
During Stage 2:
The apt-listchanges pager will display the OpenSSH release notes covering the removal of DSA keys, removal of finite-field (modp) Diffie-Hellman key exchange from sshd defaults, and removal of pre-authentication compression. Press q to continue.
You may see dpkg: warning: unable to delete old directory '/lib/firmware/...': Directory not empty. As noted in the Debian 13 release notes, these warnings are a harmless side effect of the usrmerge transition.
Stage 2 finishes by installing the Debian 13 kernel (6.12.113+deb13-amd64), updating GRUB, and building the new initramfs at the end of stage 2 installation you can see output like below.
Setting up grub-pc (2.12-9+deb13u2) ... Replacing config file /etc/default/grub with new version grub-pc: Running grub-install ... Installing for i386-pc platform. Installation finished. No error reported. grub-install success for /dev/sda Generating grub configuration file ... Found linux image: /boot/vmlinuz-6.12.113+deb13-amd64 Found initrd image: /boot/initrd.img-6.12.113+deb13-amd64 Found linux image: /boot/vmlinuz-6.1.0-54-amd64 Found initrd image: /boot/initrd.img-6.1.0-54-amd64 ... update-initramfs: Generating /boot/initrd.img-6.12.113+deb13-amd64
Stop here and do not reboot yet.
Pin Your Network Interface Name Before Rebooting
This is the most important step in a remote Debian 13 upgrade.
The official Debian 13 release notes suggest running udevadm test-builtin net_setup_link /sys/class/net/<iface> before rebooting to check whether systemd v257 will rename your network interface. On our first server upgrade, running that test right after apt full-upgrade reported that enp6s18 would keep its name:
current: enp6s18 -> after reboot: enp6s18
But the moment that server rebooted into the new kernel, SSH failed with No route to host. Inspecting the machine on a local console revealed why:
2: ens18: [BROADCAST,MULTICAST] mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether bc:24:11:9a:30:ac brd ff:ff:ff:ff:ff:ff
altname enp6s18
altname enxbc24119a30ac
On boot, systemd v257 read the hardware's ACPI _SUN slot number and renamed the interface from enp6s18 to ens18. Because /etc/network/interfaces was still configured for enp6s18, ifupdown never brought the interface up. The pre-reboot udevadm check gave a false all-clear.
To make sure your server comes back online after rebooting, pin your current interface name to its MAC address with a systemd.link file and rebuild the initramfs before you reboot:
IFACE=$(ip route show default | awk '{print $5; exit}'); echo "Pinning: $IFACE"; MAC=$(cat /sys/class/net/$IFACE/address); { echo "[Match]"; echo "MACAddress=$MAC"; echo ""; echo "[Link]"; echo "Name=$IFACE"; } | sudo tee /etc/systemd/network/10-persistent-$IFACE.link && sudo update-initramfs -u
Output from debianser:
Pinning: enp6s18 [Match] MACAddress=bc:24:11:31:f7:a1 [Link] Name=enp6s18 update-initramfs: Generating /boot/initrd.img-6.12.113+deb13-amd64
Verify the Pin, SSH Config, and Kernel Before Rebooting
Run this check to confirm that udev now loads your 10-persistent-*.link file, that the .link file is packed inside the new Debian 13 initramfs, that sshd configuration syntax is valid, and that the linux-image-amd64 metapackage is installed:
IFACE=$(ip route show default | awk '{print $5; exit}'); udevadm test-builtin net_setup_link /sys/class/net/$IFACE 2>/dev/null | grep -E 'ID_NET_LINK_FILE=|ID_NET_NAME=' && lsinitramfs /boot/initrd.img-*+deb13-amd64 | grep persistent- && sudo sshd -t && echo "sshd OK" && sudo dpkg --audit && echo "dpkg clean" && dpkg -l linux-image-amd64 | grep ^ii
Output:
ID_NET_LINK_FILE=/etc/systemd/network/10-persistent-enp6s18.link ID_NET_NAME=enp6s18 usr/lib/systemd/network/10-persistent-enp6s18.link sshd OK dpkg clean ii linux-image-amd64 6.12.113-1 amd64 Linux for 64-bit PCs (meta-package)
Seeing ID_NET_LINK_FILE=/etc/systemd/network/10-persistent-enp6s18.link and usr/lib/systemd/network/10-persistent-enp6s18.link inside the initramfs confirms your interface name is locked in from early boot.
Reboot and Verify Debian 13 Over SSH
Now reboot your server into Debian 13:
sudo systemctl reboot
Wait 30 to 60 seconds, SSH back into the server, and verify the interface name, Debian release, running kernel, and systemd unit health.
ip -br addr && cat /etc/debian_version && uname -r && systemctl --failed
Output after reconnecting over SSH:
lo UNKNOWN 127.0.0.1/8 ::1/128 enp6s18 UP 192.168.100.68/24 fe80::be24:11ff:fe31:f7a1/64 13.7 6.12.113+deb13-amd64 UNIT LOAD ACTIVE SUB DESCRIPTION 0 loaded units listed.
Because of the .link file we created earlier, enp6s18 kept its name, brought up its IPv4 address immediately, and accepted SSH connections on the first try.
Emergency Recovery: What If You Forgot to Pin the NIC and Got Locked Out?
If you already rebooted a server without pinning the interface name and cannot reach it over SSH:
- Open your hosting provider's out-of-band VNC/serial console or IPMI/iDRAC console and log in locally.
- Run
ip a. You will see your interface in stateDOWNwith a new name (such asens18) and its old name listed right underneath asaltname enp6s18. - Update
/etc/network/interfacesto match the new name and bring the interface up:
sudo sed -i 's/enp6s18/ens18/g' /etc/network/interfaces && sudo ifup ens18 && ip -br addr show ens18
The interface will pull its IP address immediately and SSH will start responding again.