Raspbian distro upgrade

My Raspberry pi boards are running on “buster” and now since “bullseye” is out, I thought to update them. While doing this, I thought to capture steps to help others. Here are the steps.

First update repositories

manish@finch:~ $ sudo apt update

Get:1 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]                          
Hit:2 http://archive.raspberrypi.org/debian buster InRelease                                       
Fetched 15.0 kB in 6s (2,366 B/s)                                                                                                                    
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

manish@finch:~ $ 

Now run full upgrade command

manish@finch:~ $ sudo apt dist-upgrade -y

Reading package lists... Done
Building dependency tree       

Update raspberry pi firmware

manish@finch:~ $ sudo rpi-update

 *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
 *** Performing self-update

Next edit source.list at /etc/apt/sources.list to change distro from “buster” to “bullseye”

manish@finch:~ $ cat /etc/apt/sources.list

#deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi

Update bullseye repositories

manish@finch:~ $ sudo apt update

Get:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease [15.0 kB]
Hit:2 http://archive.raspberrypi.org/debian buster InRelease
Get:3 http://raspbian.raspberrypi.org/raspbian bullseye/main armhf Packages [13.2 MB]
Get:4 http://raspbian.raspberrypi.org/raspbian bullseye/contrib armhf Packages [60.2 kB]

Finally run distro upgrade wrt to “bullseye” repositories

manish@finch:~ $ sudo apt dist-upgrade

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Error!
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

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.

I encountered above error during upgrade and then found a helpful thread at https://unix.stackexchange.com/questions/592657/full-upgrade-to-debian-testing-fails-due-to-libc6-dev-breaks-libgcc-8-dev. Following this, I executed

manish@finch:~ $ sudo apt install gcc-8-base

Reading package lists... Done
Building dependency tree       
Reading state information... Done

Now again try dist-upgrade

manish@finch:~ $ sudo apt dist-upgrade
 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done

Once upgrade is complete, verify debian version.

manish@finch:~ $ cat /etc/debian_version 
11.5

At last run

sudo apt autoclean