Upgrading Debian 10 to Debian 11

Overview

This page provides a step-by-step guide for the distribution upgrade from Debian 10 to Debian 11, tailored to the minimal set of packages that are required for Cryptshare for Mail Gateway. To see the full official guide, visit the Debian 11 release notes.

Preparation

  • Create a backup or snapshot of the system before installing, so that you can restore the initial state easily.

  • Inform your users about the system downtime, which will be around 1–2 hours depending on the speed of the internet connection. During the upgrade, messages will not be delivered reliably.

Upgrade Steps

  1. Become root:

sudo su
  1. Remove unofficial packages. Their configuration files remain:

apt remove ansible
apt remove postfix
apt autoremove
  1. Clean up /etc/apt/sources.list and replace its contents with:

deb http://deb.debian.org/debian/ buster main
deb-src http://deb.debian.org/debian/ buster main

deb http://security.debian.org/debian-security buster/updates main
deb-src http://security.debian.org/debian-security buster/updates main

deb http://deb.debian.org/debian/ buster-updates main
deb-src http://deb.debian.org/debian/ buster-updates main
  1. Update to the latest Buster packages:

apt update
apt upgrade
apt full-upgrade
apt autoremove
reboot
  1. Become root again:

sudo su
  1. Replace the contents of /etc/apt/sources.list with:

deb http://deb.debian.org/debian bullseye main contrib non-free
deb http://deb.debian.org/debian bullseye-updates main contrib non-free
deb http://security.debian.org/debian-security bullseye-security main contrib non-free
  1. Perform the upgrade:

apt clean
apt update
apt full-upgrade
  1. Shortly after the package information is loaded, release notes are displayed. Confirm them with the Q key.

  2. Answer questions during package upgrades.

    • Questions like this:

Configuration file '/etc/powerdns/recursor.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ? Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** recursor.conf (Y/I/N/O/D/Z) [default=N] ?
  • For /etc/resolvconf/resolv.conf.d/head: N

  • For /etc/opendkim.conf: N

  • For /etc/opendmarc.conf: N

  • For /etc/powerdns/recursor.conf: N

  • Question about dbconfig-common for OpenDMARC: No

  • Question about libc6 upgrade: Yes

  • Question about libc6 automated restarts: Yes

  1. Reboot:

reboot
  1. Become root again:

sudo su
  1. Install Postfix and the SPF daemon again:

apt install postfix
# -> Answer question with "No configuration"

apt install postfix-pgsql
apt install postfix-policyd-spf-python
  1. Update PostgreSQL.

Stop services:

systemctl stop cmg-filter
systemctl stop postgresql

Start the upgrade:

su postgres
cd /tmp
/usr/lib/postgresql/13/bin/pg_upgrade --old-datadir=/var/lib/postgresql/11/main --new-datadir=/var/lib/postgresql/13/main --old-bindir=/usr/lib/postgresql/11/bin --new-bindir=/usr/lib/postgresql/13/bin --old-options '-c config_file=/etc/postgresql/11/main/postgresql.conf' --new-options '-c config_file=/etc/postgresql/13/main/postgresql.conf'
exit

Remove the old installation:

apt purge postgresql-11
# -> Answer question with yes, remove configuration files

apt purge postgresql-client-11
/tmp/delete_old_cluster.sh

Edit /etc/postgresql/13/main/postgresql.conf and change the port back to the default:

...
port = 5432
...

Restart the PostgreSQL service:

systemctl restart postgresql
  1. Reboot one last time:

reboot