Operating system updates are crucial to your system’s security, and that includes upgrading to a new major release.
In this guide we show you how to perform a safe, controlled Debian release upgrade on your VPS, for example from Debian 12 ‘Bookworm’ to Debian 13 ‘Trixie’).
Upgrading a Debian release
Step 1
Connect to your VPS via SSH or the VPS console.
Step 2
Fully update your current system:
sudo apt -y update && sudo apt -y upgrade
Remove unnecessary packages:
sudo apt -y --purge autoremove
Step 3
Adjust your APT sources by changing the codename of the current release to the new one, for example from ‘bookworm’ (Debian 12) to ‘trixie’ (Debian 13). You can do this manually or with a replace command. Update both /etc/apt/sources.list and any files in /etc/apt/sources.list.d/ (in most cases you only need to edit /etc/apt/sources.list.d/debian.sources)..
Update manually:
Open the file containing the Debian sources, for example:
nano /etc/apt/sources.list.d/debian.sources
Change the codename of the current release, for example from ‘bookworm’ to the new release ‘trixie’:
Types: deb deb-src
URIs: mirror+file:///etc/apt/mirrors/debian.list
Suites: trixie trixie-updates trixie-backports
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb deb-src
URIs: mirror+file:///etc/apt/mirrors/debian-security.list
Suites: trixie-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Update automatically via the command line:
sudo find /etc/apt -name "*.sources" -type f -exec sudo sed -i 's/bookworm/trixie/g' {} \;
sudo find /etc/apt -name "*.list" -type f -exec sudo sed -i 's/bookworm/trixie/g' {} \;
Step 4
Refresh the package list and perform a minimal upgrade to update core components without breaking dependencies, then reboot your VPS:
sudo apt -y update && sudo apt -y upgrade
sudo reboot
- You’ll likely be asked whether services may be restarted automatically. We recommend allowing this and, after the update, checking that your most-used services have restarted without further issues.
- The reboot is optional, but some packages require a restart to fully apply changes. Rebooting first helps rule out issues caused by the update process.
Step 5
Now perform the release upgrade and then reboot your VPS:
sudo apt -y full-upgrade
sudo reboot
Read any prompts carefully, especially for configuration files. Choose whether to keep your version or accept the maintainer’s version. If you’re unsure, note the changes and compare later.
Step 6
After the reboot, check the release version with one of the following commands:
cat /etc/os-release | sed -n 's/^PRETTY_NAME=//p'
cat /etc/debian_version
lsb_release -a
Step 7
Clean up old packages and clear the APT cache:
sudo apt -y --purge autoremove && sudo apt clean
Then check for errors in the current boot:
sudo journalctl -p err -b
If you worked through these steps over SSH, you’ll probably only see an SSH-related error due to the connection being dropped.
Congratulations! Your Debian release has now been safely and in a controlled manner upgraded to a new release version.