Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save diffficult/ff1c5b2fa1dd00a5de5fce7f7e8293ae to your computer and use it in GitHub Desktop.
Save diffficult/ff1c5b2fa1dd00a5de5fce7f7e8293ae to your computer and use it in GitHub Desktop.
Raspberry OS Bullseye to Bookworm

Upgrading Raspberry Pi OS from Bullseye to Bookworm (11 to 12)

Upgrading Raspberry Pi OS from Bullseye to Bookworm (11 to 12)

Debian version 12, called Bookworm, was recently released. After only a few months of waiting, a version optimized for the Raspberry Pi was released, so it was time to upgrade. If I already did it for me, I'll write a step by step guide :)

The full changelog is here:
https://wiki.debian.org/NewInBookworm

If you write or run shell scripts, please consider the following:

  • The "which" program has been deprecated, use command -v instead.
  • /bin/sh is not longer supported (and use ksh instead, because it's faster).
  • A syslog daemon, such as rsyslog, is no longer installed by default.

Follow the step-by-step instructions below and you will end up with a stable, clean and fresh Debian 12-based system for your Raspberry Pi. The whole process takes about 1 hour, including everything.

Let's update!

  1. Check the current Debian version:
    cat /etc/debian_version

  2. First make a backup. I usually use the "Win32 Disk Imager" software on Windows.
    Don't miss this step. The guide has been tested and reviewed several times, but it's always better to be prepared for the unexpected.

  3. Open an SSH connection (PuTTY tricks here)

  4. Be root with this command:
    sudo su

  5. The upgrade process will take approximately 30 minutes. If you close the Terminal or lose connection during the upgrade process, errors will occur. To avoid this, start a screen and run the command in that session:
    screen -R upgrade

  6. Update all packages:
    apt update && apt upgrade

  7. Remove unnecessary packages:
    apt --purge autoremove

  8. Configure new repositories by replacing bullseye with bookworm:
    sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list

    This command may fail, it's okay:
    sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*

  9. Check for new packages:
    apt update

  10. Upgrade only existing packages on the system:
    apt upgrade --without-new-pkgs -y

  11. Press 'q' when you see the ":" as a prompt. It's just a manual.

  12. During the upgrade process, follow the on-screen instructions carefully, as you may be asked a few questions during the process, such as “Would you like to restart the service?” or “Keep or erase configuration file options?” throughout the process.
    If you don't know what is the right answer, I'd recommend just press "Enter" to select the default one.

  13. And now the final upgrade:
    apt full-upgrade -y

  14. Reboot the system:
    reboot

  15. Check the Debian version now:
    cat /etc/debian_version

  16. Remove old and unused packages:
    apt --purge autoremove

  17. If you have shell scripts, don't forget to check them based on these:
    - Replace "which" with command -v
    - Replace /bin/sh with /bin/bash, or with /bin/ksh
    - syslog is not installed by default, you may need to replace the corresponding commands (like rsyslog)

  18. That's it, we're done.


Source: https://feriman.com/upgrading-raspberry-pi-os-from-bullseye-to-bookworm-11-to-12/

Tested on five raspberry pi 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment