The Raspberry pi foundation released Raspbian Bullseye in Nov 2021, and Raspbian buster became obsolete. You should update your raspberry pi from buster to bullseye in order to get the latest security updates and software patches.
The Raspberry pi foundation recommends having a clean install of Raspbian bullseye from a new drive instead of upgrading it from buster. I agree because it cost me a total of 6 copies of cloned Raspberry pi backup in order to upgrade to Raspbian bullseye successfully.
If you insist on upgrading your raspberry pi from buster to bullseye, here are the things you have to take care of:
1. Make sure you have a cloned backup of your Raspbian OS. You can look at my previous article about how to create a cloned backup via DiskGenius.
2. Ensure you can SSH to your Raspberry pi. The GUI may not work after the update. You may need SSH for troubleshooting. Having another remote software such as TeamViewer or AnyDesk as a backup plan is a plus.
3. Your Raspberry pi should connect to a LAN interface. The wireless interface may reset after upgrading to Raspbian bullseye. Having physical access to your Raspberry pi is recommended.
I only tested the following guide on a Raspberry pi 4. It may not work for other Raspberry pi. Again, you must have a cloned backup before executing any commands on this guide, as the commands you enter are irreversible.
Step 1: Update the package list and install the required packages
sudo apt update
Step 2: Update your system packages to the latest buster version and remove the old packages.
sudo apt dist-upgrade -y
Step 3: Update the Raspberry pi source list
sudo nano /etc/apt/sources.list
change
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
to
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
Press Ctrl + X to save the file.
Performing the same thing to raspi.list if it exists.
sudo nano /etc/apt/sources.list.d/raspi.list
Step 4: Update your system packages to the latest bullseye version and remove the old packages.
sudo apt dist-upgrade -y
Step 5: During the update, you may encounter an error like this
The following packages have unmet dependencies:
libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-6+rpi1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
Enter
sudo apt install gcc-8-base -y
then
sudo apt dist-upgrade -y
to continue the installation.
Press q to stop reading the changelogs.
Later on, you will face an error like this.
got an old version of npm installed, possibly because you installed it manually
Errors were encountered while processing:
nodered
Preparing to unpack .../150-nodered_2.2.3-2_armhf.deb ...
dpkg: error processing archive /tmp/apt-dpkg-install-CujUtn/150-nodered_2.2.3-2_armhf.deb (--unpack):
new nodered package pre-installation script subprocess returned error exit status 5
Errors were encountered while processing:
/tmp/apt-dpkg-install-CujUtn/150-nodered_2.2.3-2_armhf.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
Luckily I can read german, and I found the solution through a german article by Georg Keller.
I have made a small modification to his solution. The option “–node12” will ensure the script function correctly.
sudo apt-get remove nodered
sudo apt-get autoremove
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered) --node12
Continue the update after the troubleshooting.
sudo apt dist-upgrade -y
Step 6: It seems everything is fine as you can execute the “sudo apt dist-upgrade -y” till the end, but it’s not. Check the status of your lightdm service by
sudo systemctl status lightdm
You will find something like
:active (running)
Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files
To fix it, you must install the Pipanel and related packages again.
sudo apt install accountsservice -y
sudo apt install pipanel -y
sudo apt-get install raspberrypi-ui-mods -y
Step 7: Reboot the system to take effect. You may encounter errors like
invalid menu directory 'system/lxterminal.desktop'
or
invalid menu directory 'Accessories/pcmanfm.desktop
when you click the folder or terminal icon on the taskbar. It can be fixed by rebooting your Raspberry pi again.
Step 8: Check your Raspberry pi OS version by
lsb_release -a
Optional: Update Raspberry pi firmware to reduce the risk of vulnerabilities being exploited.
sudo rpi-update
Congratulation if your Raspbian GUI works appropriately. If not, you have some missing packages on your Raspbian buster system that are required for the Raspbian bullseye system. You should migrate your data from your cloned backup to a clean Raspbian bullseye system.
If you followed some dated guide and failed to update to Raspbian bullseye, read my troubleshooting guide.
Thanks for posting this. I’m asking just to be sure before I proceed. Does this process work on 64bit Buster as well? I have a GPS-NPT server build that has some issue which only allows the system to be built on Buster. I’ve heard from several people who have upgraded their systems to Bullseye but I you say above, it’s not pretty. I’m only using Lite and only SSH to this system.
Hello Rick,
Thanks for your comment. 🙂
I have only tried to update the 32-bit Raspbian from Buster to Bullseye. Therefore, I am unsure if my procedures also work on 64-bit Raspbian.
I believe there are also some broken dependencies when you try to upgrade the 64-bit Raspbian from Buster to Bullseye.
Why would you like to upgrade your system from Buster to Bullseye?
I upgraded my system from Buster to Bullseye because my colleagues need to use some libraries only available on Python 3.9.
If nothing is broken and you are not exposing your pi to the public network, I will highly not recommend you to proceed as the risk is relatively high.
Since you mentioned you can only access your Pi via SSH, I assume you do not have physical access to your Pi.
I always have at least two spare SD cards with a cloned system same as the one used on the remote site.
It is a good practice because even if I mess up one of the spare SD cards during an upgrade, I can still revert any changes.
After an upgrade, I will solely make changes on my remote sites’ PIs via Ansible if everything works properly.
You may have a look at my other article about how to clone your OS to a spare SD card (https://silicon.blog/2023/01/11/create-a-cloned-copy-backup-of-your-data-using-diskgenius/).