Upgrade Debian to the latest version

Stop critical services running on the host machine

systemctl stop XXX.service

Update the current running system to minimize the update gap :

apt update && apt full-upgrade

Remplace all occurrences of the old release (bookworm) with the new one (trixie) in the APT sources file :

sed -i 's/bookworm/trixie/g' /etc/apt/sources.list

Update the APT repository with the new packages list. You will get an estimate of the number of packages that will be upgraded.

apt update

Proceed with upgrading the packages. This step is the most time-consuming since it downloads the new packages. A list of important changes will be displayed, read it carefully. You can read through with Space and escape with Q. During the upgrade, you might be asked if you want to restart running services, you cant answer with Y.

apt full-upgrade

Once everything is up-to-date, restart the host :

reboot

After restarting

Confirm you are running the new OS version :

cat /etc/os-release

Post-install cleanup

Upgrade the source files to the new deb822 format, confirm with Y :

apt modernize-sources

List obsolete packages :

apt list '~o'

Attention, some packages installed outside official APT repos might be treated as obsolete. Double-check these carefully before purging obsolete packages :

apt purge '~o'
apt autoremove