Upgrade the Raspbian OS in my Raspberry Pi 3B from buster to bullseye

Background

So it's been a while since my last blog on Raspberry Pi. In that blog, I attempted to create a Wi-Fi repeater using my Raspberry Pi so that my broken Macbook Pro can connect to the Internet.

You might have guessed the reason that there is only "part 1" of that blog published: shortly after that blog, my Macbook Pro just fixed itself. Such situation, at first would drive me crazy but over the years I have adapted and accepted the occasional "temper" the OS throw at me. See my early year's blog ranting on MacOS.

Anyway, so I recently dug up my Pi 3B and I decided to make some use out of it, maybe make it a small local server for some robot scripts, etc. From an economic perspective, I would rather not let it degrade over time and eventually become e-waste.

So the first thing I want to do is naturally upgrade the system.

And that's about the background of this blog: I got some time to kill, and want to spend it on some cool projects rather than the actual project that I was supposed to focus on [ procrastinator right here :-( ]

Steps to take

Now, for Pi, the easiest way is always to wipe the SD card and do a fresh install, but, I guess we all have reasons that stopped us from doing so...

For me, I mostly followed a tutorial from Tom's Hardware (reference 1), but I encountered some package errors, and this blog is mostly to record the error I encountered.

As a first step, we need to connect to our Pi. I am using the same way as my previous blog, and connect via an ethernet cable.

Once we are in, we need to check sources.list:

$ sudo nano /etc/apt/sources.list

If your situation is like me, then your sources.list should have one uncommented line and should say buster in it.

Then, what we will do is to update the software repositories lists:

$ sudo apt update

Then run a full upgrade of your installation:

$ sudo apt dist-upgrade -y

This might take some time to finish.

Then, according to reference 1, we can update the Raspberry Pi firmware.

$ sudo rpi-update

This might prompt that we need to reboot, if this is the case, then we can run:

$ sudo reboot

After that, we can go and change 'buster' in sources.list to 'bullseye':

$ sudo nano /etc/apt/sources.list
# after change it should look like: deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi

Then, let's update the Bullseye software repositories:

$ sudo apt update

And run another distribution upgrade to install the Bullseye software requirements:

$ sudo apt dist-upgrade

If you see follow error:

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.

To fix it, I just uninstall libgcc-8-dev:

$ sudo apt remove libgcc-8-dev

Then let's rerun:

sudo apt dist-upgrade

We might be asked to restart some services, I just selected yes to restart them, and if you see the following prompt:

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
...

For that, I just chose Y.

Lastly, if no other issues, all we only need to do now is (optionally) clean up the installation files:

$ sudo apt autoclean

Now restart our Pi and it should be Debian 11!

pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 11 (bullseye)"
NAME="Raspbian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

Reference