First, back up the system. Copy your important files and any .conf files that you worked on and would hate to lose if this process goes sideways. You’ve already got backups? Good for you! Let’s go!
Next, update the existing packages and reboot the Raspberry Pi OS 10 system.
sudo apt update sudo apt upgrade
cd to /etc/apt Edit the file sources.list using a text editor and replace each instance of buster with bullseye. If you find the security line, replace buster/updates with bullseye-security. Now, while you’re looking at files, notice the directory names here that end with .d These are “include” directories and include more repos. Look through these files, too, and make any changes as outlined above. Here’s how I found the files that needed to be edited:
find . | xargs grep "buster" *
Once you get all the files under /etc/apt updated, you can update the package index:
sudo apt update
Watch for any errors here. You might find that there are more files on your system with sources that need editing as well. Edit any necessary files and run the apt update again until you can get it to run without error. To prepare for the operating system upgrade, run:
sudo apt upgrade
The system will download all the new software and then pause briefly to allow you to read the changelogs. Hit <space> to advance. Hit ‘q’ when you reach the end. Take a moment to scan through this material to see if there’s anything that’s a showstopper for your setup. Next, you’ll get warned that this upgrade can break things and you might consider doing this interactively. If you want it to run nonstop, tab to <Yes> and hit enter. Finally, update from buster to bullseye by running:
sudo apt full-upgrade
The upgrade will occasionally pause and ask if you want to keep or update a config file. Those interactions look like this:
Installing new version of config file /etc/default/snmpd ... Installing new version of config file /etc/init.d/snmpd ... Configuration file '/etc/snmp/snmpd.conf' ==> Modified (by you or by a script) since installation. ==> 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 N or O : keep your currently-installed version D : show the differences between the versions Z : start a shell to examine the situation The default action is to keep your current version. *** snmpd.conf (Y/I/N/O/D/Z) [default=N] ?
Here the system found a file that I modified from the package, my SNMP configuration, and wants to know if it can replace it or keep my modified version. I like my SNMP config so I hit enter to choose “N” and keep the “currently-installed version”. Work your way through these until you get to the command line prompt. Enter a couple more commands to clean up the mess, and you should have a new OS:
apt dist-upgrade apt autoremove apt autoclean
Now you can reboot the Raspberry and boot into Bullseye!
pi@raspberrypi:~ $ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 11 (bullseye)" NAME="Debian GNU/Linux" VERSION_ID="11" VERSION="11 (bullseye)" VERSION_CODENAME=bullseye ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" pi@raspberrypi:~ $
How hard was that?