Upgrade Debian to Latest Version
Complete guide for safely upgrading your Debian 12 (Bookworm) server or desktop to Debian 13 (Trixie), the current stable release.
Important: Major Debian upgrades must always be performed one release at a time without skipping versions (
bookworm→trixie, or the current release to the next stable release).
Prerequisites
-
Back up your data (Critical!).
-
Ensure you have root access or
sudoprivileges, and console/KVM access if upgrading a remote server. -
Check for held packages and third-party or DEB822 APT sources before upgrading:
sudo apt-mark showhold ls -la /etc/apt/sources.list.d/(Unhold held packages with
sudo apt-mark unhold <package>and temporarily disable incompatible third-party repositories before starting the distribution upgrade.)
Step 1: Update Existing System
Before upgrading, make sure your current Debian 12 system is fully up to date:
sudo apt update
sudo apt upgrade
sudo apt full-upgrade
sudo apt --purge autoremove
Step 2: Update APT Sources (bookworm → trixie)
Update your package repositories from bookworm to trixie (checking both /etc/apt/sources.list and /etc/apt/sources.list.d/ such as debian.sources).
-
Inspect your active APT configuration:
cat /etc/apt/sources.list ls -la /etc/apt/sources.list.d/ -
Replace all instances of
bookwormwithtrixiein/etc/apt/sources.list(if used) or in/etc/apt/sources.list.d/debian.sources(DEB822 format):Classic
/etc/apt/sources.listexample for Debian 13 (trixie):deb https://deb.debian.org/debian trixie main contrib non-free non-free-firmware deb https://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware deb https://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmwareDEB822
/etc/apt/sources.list.d/debian.sourcesexample for Debian 13 (trixie):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(Note: Both
http://andhttps://mirrors work natively, and APT always verifies repository integrity cryptographically using GPG signatures via SecureApt.) -
Save and exit (
Ctrl + O, Enter,Ctrl + X). Also inspect any third-party files in/etc/apt/sources.list.d/and update or temporarily comment out oldbookwormentries.
Step 3: Run the Upgrade
Important: Do not pass
-y(--assume-yes) during major Debian release upgrades. The official Debian Release Notes advise reviewing the package list carefully before confirming so unexpected package removals do not catch you off guard.
-
Update package lists with the new Debian 13 (
trixie) sources:sudo apt update -
Perform a minimal upgrade first (avoids dependency conflicts):
sudo apt upgrade --without-new-pkgs -
Perform the full distribution upgrade interactively:
sudo apt full-upgradeDuring this process:
- Several services will restart.
- You may be asked whether services should be restarted automatically during library upgrades. Choosing Yes is usually convenient unless critical services require manual coordination.
- You may be prompted about modified configuration files. If you have not customized a file, choose "Install the package maintainer's version". If you have customized it yourself, choose "Keep your currently-installed version" and review
.dpkg-distdifferences afterwards.
Step 4: Reboot and Verify
-
Restart your system:
sudo reboot -
Verify the new version:
cat /etc/debian_version cat /etc/os-release/etc/debian_versionshould show13.xand/etc/os-releaseshould showVERSION_CODENAME=trixie.
Step 5: Post-Upgrade Cleanup & Modernization
Remove obsolete packages to free up disk space (review the removal list before confirming):
sudo apt --purge autoremove
sudo apt clean
Note two important changes in Debian 13 (trixie):
- Debian 13 drops
/etc/sysctl.conf— move any custom kernel settings into/etc/sysctl.d/*.conf(for example/etc/sysctl.d/99-custom.conf). - If you still use legacy one-line
.listfiles, convert them cleanly to modern DEB822.sourcesformat usingsudo apt modernize-sources.
Troubleshooting
"Firmware missing" errors
Ensure non-free-firmware is included in your APT sources (as shown in Step 2), then run:
sudo apt update && sudo apt install -y firmware-linux
SSH Disconnected
If upgrading a remote server, running sudo reboot is normally safe, but keep out-of-band console access (VNC/KVM/serial) available in case network interface names or firewall configurations change during the upgrade.