Upgrading to bookworm

Upgrading to bookworm
Photo by Taylor / Unsplash

I have had a Linux distro running bullseye for a few years, sitting, idly for me to do something with it. And now that I have decided to play around with it, I did a quick check to see Debian's current releases. Upgrading an OS without any running software is a lot easier, so keep that in mind if you happen to land in my corner.

Since I didn't need to worry about breaking changes nor backups, I could get going quite easily.

The following is a copy from Debian's wiki. Read it first, once over before running any commands. And do make sure you understand what you are doing. If you don't, read the documentation on upgrades.

# First, ensure your system is up-to-date in it's current release.
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get full-upgrade

# If you haven't already, ensure all backups are up-to-date.  

# In a text editor, replace the codename of your release with that of the next release in APT's package sources
# For instance, the line
#    deb https://deb.debian.org/debian/ buster main
# should be replaced with
#    deb https://deb.debian.org/debian/ bullseye main
$ sudo nano /etc/apt/sources.list /etc/apt/sources.list.d/*

# If you are migrating to Bookworm or later, then a new repo for non-free firmware is available.
# If you wish, you can add non-free and non-free-firmware, depending on your specific needs.
# For instance, the line
#    deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
# or
#    deb https://deb.debian.org/debian/ stable main contrib non-free non-free-firmware

# Clean and update package lists
$ sudo apt-get clean
$ sudo apt-get update

# Perform the major release upgrade, removing packages if required
# Interrupting this step after downloading has completed is an excellent way to stress-test your backups
$ sudo apt-get upgrade
$ sudo apt-get full-upgrade

# Remove packages that are not required anymore
# Be sure to review this list: you may want to keep some of them
$ sudo apt-get autoremove

# Reboot to make changes effective (optional, but recommended)
$ sudo shutdown -r now

The line sudo nano /etc/apt/sources.list /etc/apt/sources.list.d/* is a little advanced for me. The first argument opens the file, while the second uses a wildcard to open all the files under the sources.list.d/*. I don't want to be editing multiple files at once. And since I am unfamiliar with nano, vim it is.

sudo vim /etc/apt/sources.list. Do a general search and replace :%s/bullseye/bookworm/g. Then we have to do the same for the files within /sources.list.d/

Finally, after rebooting the system and checking that APT was still working, I was getting a warning which was fixed by adding a configuration file suggested by the tool itself. Which was a good thing because I had overlooked the files within /sources.list.d/*.

Now I can get back to installing nginx.