Upgrade a Debian Install
(Also works on Debian-based containers.)
This really only requires a couple of operations — update the APT repos and then pull the new version.
Note: If apt update returns GPG errors, check for broken third-party repo files in /etc/apt/sources.list.d/ and remove the offending ones before proceeding (e.g. rm /etc/apt/sources.list.d/<filename>.list).
First make sure we've updated to the latest build of the current Debian version:
apt update
apt full-upgrade
Then update the sources and do the upgrade (this example moves from bookworm to trixie — substitute your own release names):
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
apt update
apt dist-upgrade
apt autoremove
reboot