11 Debian Upgrade
tengel edited this page 2026-01-13 08:12:16 -06:00

Debian Upgrade

Prep

Before upgrading, upgrade and repair existing problems:

apt-get update
apt-get upgrade
apt-get full-upgrade

apt-get autoremove --purge
dpkg -l | grep -v ^ii
apt list '?narrow(?installed, ?not(?origin(Debian)))'
apt-mark showhold

reboot

Sources

deb http://deb.debian.org/debian/ trixie main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ trixie main contrib non-free non-free-firmware

deb http://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
deb-src http://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware

deb http://deb.debian.org/debian/ trixie-updates main contrib non-free non-free-firmware
deb-src http://deb.debian.org/debian/ trixie-updates main contrib non-free non-free-firmware

Upgrade

Notes:

  • choose "yes" to restart services automatically
  • keep existing configs as desired (usually Keep)
  • let GRUB re-install to the boot disk if asked
apt-get update
apt-get upgrade --without-new-pkgs
apt-get full-upgrade

Check

Some upgrades change behaviour and need to be addressed prior to a reboot; for example Nginx configs have set the server_tokens off; setting by default in Trixie (13), which will lead to an error and a failure to restart - as the local config is now a duplicate:

nginx[45027]: [emerg] 45027#45027: "server_tokens" directive is duplicate in /etc/nginx/conf.d/security.conf:9
nginx[45027]: nginx: configuration file /etc/nginx/nginx.conf test failed
systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE

Fix the issues, e.g.:

$ vim /etc/nginx/conf.d/server.conf
#server_tokens off;

Re-run apt-get full-upgrade and the process will complete.

Reboot

reboot

Cleanup

Look for strays, "rc" tends to mean it can be purged (was to be removed, failed):

apt-get autoremove --purge
dpkg -l | grep -v ^ii
 ...
 rc  python     2.7.16-1        amd64

apt-get purge python

Look for installed packages not in the repo anymore (obsoleted):

apt list '~o'
apt purge '~o'

Look for stale/leftover configs from removed packages:

apt list '~c'
apt purge '~c'

Run a metadata clean on apt, it should show messages about deleting old index data, packages or other legacy data.

apt-get autoclean

The above is an example from a minimal install.