Summer is gone and at home there is some maintenance to do. #RaspberryPiOS has updated from #bullseye to #bookworm and I have some machines to catch up. Here I log the steps I did to upgrade the first one.

Overview

Even it is really not a complicated process, I organised this article in the following sections:

  1. Context

  2. Requirements

  3. Upgrade the host

  4. Check the current version

  5. Wrapping up

1. Context

It is widely known that the Raspberry Pi OS is a linux distribution based on Debian. Apart from the very interesting history that comes through the community, Raspbian and the Raspberry Pi Foundation (Raspberry Pi OS - Wikipedia), we need to know that it follows the Debian versioning and at this point in time it is the 12 bookworm, and the Raspberry Pi OS has updated its repositories.

Here a small table of the Debian relase dates:

Debian version Code name Release date
Debian 8 Jessie September 2015
Debian 9 Stretch August 2017
Debian 10 Buster June 2019
Debian 11 Bullseye November 2021
Debian 12 Bookworm June 2023

I want to mention that I mainly followed the following article:

2. Requirements

3. Upgrade from the terminal

ℹ️When writing this article Bookworm is the last version, and here I try to upgrade it from Bullseye.

  1. Upgrade the package repository.

    sudo apt-get update
    sudo apt-get upgrade -y
  2. Reboot the system

    reboot
  3. Edit the apt sources list file. We want to update the sources to be able to get the new distribution ones.

    sudo nano /etc/apt/sources.list
  4. Update the sources. The file we have opened has the following lines:

    sources_list_bullseye

    What we should do is to replace here bullseye to bookworm , so it ends up like this:

    deb http://deb.debian.org/debian bookworm main contrib non-free
    deb http://security.debian.org/debian-security bookworm-security main contrib non-free
    deb http://deb.debian.org/debian bookworm-updates main contrib non-free

    Note that we changed the occurrences in the three lines, including bookworm, bookworm-security and bookworm-updates

    Also note that from the 7 lines you see, the last 4 are commented and therefore not used by now. I recommend that you also replace the occurences in these ones to avoid uncommenting later on and fall into a mess of versions.

    Now I have these in my file:

    sources_list_bookworm

  5. Save (ctrl + o) and exit (ctrl + x)

  6. Update now the package list

    sudo apt update

    Now you can see that the package list refers to bookworm and not bullseye

    updating_packages

  7. Now upgrade the system

    sudo apt upgrade

    It will show a big list of packages to upgrade and ask you if you want to continue. Press Y.

    Now it will download the packages, and may take a while.

    Then it shows a list of changes in a man format, so you can press q to exit.

    Now it installs them. It may present a screen saying that there are services that will need to update and restart, automatically if we say so. We're talking about services like cron and ssh. Select Yes with the Tab and press Enter.

    It may present a stopping question regarding /etc/login.defs, and the changes you have there and the changes it comes from the new distribution. You can press D to check what are they and decide if you press Y to accept loosing your changes and assuming the new version, or N to keep yours. I've checked and accepted the new ones.

  8. Now run the command that handles changes in the dependencies

    sudo apt dist-upgrade

    It is not mandatory but it is recommended as it does dependency resolution, as explained in the apt manual pages:

    • upgrade: upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version. An update must be performed first so that apt-get knows that new versions of packages are available.

    • dist-upgrade: dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The dist-upgrade command may therefore remove some packages. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files. See also apt_preferences (5) for a mechanism for overriding the general settings for individual packages.

    Will be the same procedure: Download, show changes (press q), install, accept new config (press Y).

  9. Reboot the system

    sudo reboot

4. Check the current version

At this point, there's only one thing left, and it's to see if we're now running the Bookworm version.

cat /etc/debian_version

It should appear something like:

12.1

Meaning we're under version 12 of Debian, and that's Bookworm 🚀

5. Wrapping up

As shown, this is not a complicated process by itself, but could bring some headaches if the system is hosting any instance that has hard dependencies to any previous version package. Be sure that your software is compatible with the latest version of Debian before updating.

Previous Post Next Post