Upgrade Debian 10 to Debian 11

This walk-through explains the steps to upgrade from Debian 10 to Debian 11. Since I had to upgrade my motherboard (after 16 years of operation!) (see Machines) I could not access the internet before upgrading Debian to Bullseye. In my specific case this is because the B550m motherboard from Asrock is equipped with a Realtek RTL8111H NIC which is only supported in kernels newer than 4.19, and Debian 10 is still based on Linux kernel 4.19. Several attempts to install a newer Realtek driver failed, therefore I decided to upgrade to Debian 11 offline through an iso image.

Steps

  1. Backup essential folders and files
    • /etc
    • /var/lib/dpk
    • /var/lib/apt/extended_states
    • output of dpkg –get-selections “*”
      sudo dpkg --get-selections "*" > selections
    • /home directory and hidden files to prevent some applications from overwriting existing user settings with new defaults
  2. Download Debian iso file and copy it to your host's home directory. Make sure you download the iso containing all desktop environments, or the one matching your installed desktop environment.
  3. Add the iso file to fstab so it will mount when rebooting. At the bottom of fstab enter the following line:
    /home/user/debian-11.6.0-amd64-DVD-1.iso /media/cdrom/ iso9660 loop 0 0
  4. Record the session. It is strongly recommended that you use the /usr/bin/script program to record a transcript of the upgrade session. Then if a problem occurs, you will have a log of what happened, and if needed, can provide exact information in a bug report. To start the recording, type:
    script -t 2>~/upgrade-bullseye1.time -a ~/upgrade-bullseye1.script
  5. Do a minimal system upgrade first:
    sudo apt upgrade --without-new-pkgs
  6. Avoid libreoffice to be installed. Hold the package:
    sudo apt-mark hold libreoffice*
  7. Do the distro upgrade:
    sudo apt full-upgrade
  8. Remove the hold:
    sudo apt-mark unhold libreoffice*

    Show all packages on hold:

    sudo apt-mark showhold
  9. After you have completed the upgrade, you can stop script by typing exit at the prompt. If you have used the -t switch for script you can use the scriptreplay program to replay the whole session:
    sudo scriptreplay ~/upgrade-bullseyestep.time ~/upgrade-bullseyestep.script
  10. Remove folders which should but could not be removed during the upgrade
  11. Remove obsolete packages
    sudo apt autoremove
  12. Configure NIC:
    sudo vim /etc/network/interfaces

    Replace content with:

    # The loopback network interface
    auto lo
    iface lo inet loopback
     
    # The primary network interface
    auto enp0s5
    iface enp0s5  inet static
     address 192.168.2.236
     netmask 255.255.255.0
     gateway 192.168.2.254
     dns-domain sweet.home
     dns-nameservers 192.168.2.254
  13. Reboot, then check internet is accessible
  14. Change host name
    sudo hostnamectl set-hostname <new-host-name>
    sudo vim /etc/hosts