Upgrade Debian from Buster to Bookworm

buster2bookworm.jpg
buster2bookworm.jpg

About

In this sce­nario, the de­vice has an aarch64 chipset and is run­ning Arm­bian, which is based on De­bian.
It pro­vides a step-by-step guide for up­grad­ing from De­bian 10 (Buster) to De­bian 11 (Bulls­eye), and then to De­bian 12 (Book­worm).


Upgrade from Buster to Bullseye

  1. Backup data.

This should al­ways be the first step be­fore mak­ing ma­jor sys­tem changes. You can use tools like rsync or tar to back up the data.

  1. Verify Current Debian Version
lsb_release -a

2023-07-14_081241.png
2023-07-14_081241.png

  1. Update the current system.

En­sure the cur­rent sys­tem is fully up-to-date by run­ning:

sudo apt update  && sudo apt upgrade -y
sudo apt full-upgrade
  1. Change the repositories.

Cre­ate a backup of cur­rent sources.list file by re­nam­ing it to sources.lists.bak

sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak

Cre­ate a new one with the fol­low­ing con­tents:

sudo cat >> /etc/apt/sources.list << EOF
deb [arch=arm64,armhf] http://deb.debian.org/debian bullseye main contrib non-free
deb [arch=arm64,armhf] http://deb.debian.org/debian bullseye-updates main contrib non-free
deb [arch=arm64,armhf] http://deb.debian.org/debian bullseye-backports main contrib non-free
deb [arch=arm64,armhf] http://security.debian.org/ bullseye-security/updates main contrib non-free
EOF

Edit /etc/apt/sources.list.d/* files to point to Bulls­eye in­stead of Buster.

sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*.list
  1. Update the package list.

Run the fol­low­ing com­mand to up­date the pack­age list:

sudo apt update
Hit:1 http://deb.debian.org/debian bulls­eye In­Re­lease
Hit:2 http://deb.debian.org/debian bulls­eye-up­dates In­Re­lease
Hit:3 http://deb.debian.org/debian bulls­eye-back­ports In­Re­lease
Hit:4 http://security.debian.org bulls­eye-se­cu­rity/​up­dates In­Re­lease
Get:5 http://mirrors.sustech.edu.cn/armbian bulls­eye In­Re­lease [53.3 kB]
Fetched 53.3 kB in 2s (24.6 kB/​s)
Read­ing pack­age lists... Done
Build­ing de­pen­dency tree
Read­ing state in­for­ma­tion... Done
397 pack­ages can be up­graded. Run 'apt list --upgrad­able' to see them.
  1. Perform a minimal system upgrade:
    Upgrade all existing packages without installing or removing any additional packages with this command:
sudo apt upgrade --without-new-pkgs

Af­ter this op­er­a­tion, sev­eral ques­tions will be asked to con­firm. Keep press­ing the Enter key to con­tinue. Be­low are some ex­am­ples:

The de­fault ac­tion is to keep your cur­rent ver­sion.
* is­sue.net (Y/​I/​N/​O/​D/​Z) [de­fault=N] ?
  1. Upgrade the packages.
    Now you can upgrade all system's packages to Bullseye versions with:
sudo apt full-upgrade -y
  1. Restart the system.

Af­ter the up­grade is com­plete, you should restart the sys­tem to en­sure all changes are prop­erly ap­plied.

sudo reboot
  1. Check the Debian version.

Once the sys­tem re­boots, check the De­bian ver­sion to con­firm the up­grade:

lsb_release -a

2023-07-14_092619.png
2023-07-14_092619.png

Con­grat­u­la­tions on suc­cess­fully up­grad­ing to De­bian 11 (Bulls­eye)!

  1. Clean unused packages:

En­sure a clean sys­tem by re­mov­ing any pack­ages that are no longer re­quired.

sudo apt --purge autoremove -y
sudo find /etc -name '.dpkg-' -o -name '.ucf-' -o -name '*.merge-error'

Upgrade from Bullseye to Bookworm

Fol­low the same steps as above

  1. Update current system.

En­sure cur­rent sys­tem is fully up-to-date by run­ning:

sudo apt update  && sudo apt upgrade -y
sudo apt full-upgrade -y
  1. Change the repositories.

Re­place 'bullseye' with 'book­worm' in /etc/apt/sources.list and /etc/apt/sources.list.d/* files via sed.

sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/armbian.list

Ad­di­tion­ally, add the "non-free-firmware" repos­i­tory for hard­ware dri­ver sup­port.

sudo sed -i 's/non-free/non-free non-free-firmware/g' /etc/apt/sources.list
sudo sed -i 's/non-free/non-free non-free-firmware/g' /etc/apt/sources.list.d/*
  1. Update the package list.

Run the fol­low­ing com­mand to up­date the pack­age list:

sudo apt update
  1. Perform a minimal system upgrade:

Up­grade all ex­ist­ing pack­ages with­out in­stalling or re­mov­ing any ad­di­tional pack­ages with this com­mand:

sudo apt upgrade --without-new-pkgs

Af­ter this op­er­a­tion, sev­eral ques­tions will be asked to con­firm. Keep press­ing the Enter key to con­tinue. Be­low are some ex­am­ples:

The de­fault ac­tion is to keep your cur­rent ver­sion.
* is­sue.net (Y/​I/​N/​O/​D/​Z) [de­fault=N] ?
  1. Upgrade the packages.
    Now you can upgrade all system's packages to Bookworm versions with:
sudo apt full-upgrade -y
  1. Restart the system.

Af­ter the up­grade is com­plete, you should restart the sys­tem to en­sure all changes are prop­erly ap­plied.

sudo reboot
  1. Check the Debian version.

Once the sys­tem re­boots, check the De­bian ver­sion to con­firm the up­grade:

lsb_release -a

2023-07-14_101328.png
2023-07-14_101328.png

Con­grat­u­la­tions on suc­cess­fully to De­bian 12 (book­worm)!

  1. Clean unused packages:

En­sure a clean sys­tem by re­mov­ing any pack­ages that are no longer re­quired.

sudo apt --purge autoremove -y
sudo find /etc -name '.dpkg-' -o -name '.ucf-' -o -name '*.merge-error'

Resolving the Warning of Key Stored Issue on apt update

Issue:

When run­ning apt update, a warn­ing mes­sage may ap­pear in­di­cat­ing that a key stored in /etc/apt/trusted.gpg is no longer valid.

Solution:

To re­solve the is­sue, fol­low these steps:

  1. List the avail­able keys with the fol­low­ing com­mand:

    sudo apt-key list

    Take note of the last 8 dig­its of the pub­lic key that cor­re­sponds to the repos­i­tory be­ing up­dated.

  2. Ex­port the pub­lic key to a new file us­ing the fol­low­ing com­mand:

    sudo apt-key export <last-8-digits-of-public-key> | gpg --dearmour -o /etc/apt/trusted.gpg.d/armbian.gpg

    This will cre­ate a new trusted key file named armbian.gpg in the /etc/apt/trusted.gpg.d/ di­rec­tory.

  3. Up­date the pack­age lists to con­firm that the key is­sue has been re­solved:

    sudo apt update

Conclusion

Up­grad­ing from De­bian 10 (Buster) to De­bian 12 (Book­worm) pro­vides a range of ben­e­fits such as new fea­tures and im­prove­ments, reg­u­lar se­cu­rity up­dates, long-term sup­port, and com­pat­i­bil­ity with newer soft­ware and hard­ware.


Reference