Blog

Update Raspberry Pi OS to the Latest Version

Linux11 November 2024

Raspberry Pi OS, which is based on Debian, typically follows Debian's version releases, with a slight delay between the two. Currently, “Bookworm” is the latest Raspberry Pi OS version available for download. If you haven't upgraded to Bookworm yet or want to explore the beta versions, you're in the right place.

Upgrading Raspberry Pi OS to a newer version involves updating the APT repository list. Afterward, running update and upgrade with APT will install the latest versions of all packages.

In this guide, I'll walk you through the steps to update your system by modifying the APT configuration file and installing all available package updates.

Raspberry Pi OS versions

Before proceeding, it's important to know which version of Raspberry Pi OS you're currently using and the newer versions available.

As mentioned, Raspberry Pi OS is based on Debian and follows its version releases:

Debian VersionCode NameRelease Date
Debian 8JessieSeptember 2015
Debian 9StretchAugust 2017
Debian 10BusterJune 2019
Debian 11BullseyeNovember 2021
Debian 12BookwormJune 2023

If you're using an older version, now is a great time to consider updating.

Upgrade your system (with the existing repositories)

Begin by updating your system with the existing repositories to ensure you have the latest packages available for your current version before proceeding with the full upgrade.

sudo apt update
sudo apt upgrade -y

If there were numerous updates, reboot the Raspberry Pi to apply the changes.

sudo reboot

Update the sources.list file(s)

As mentioned earlier, we use APT to update all system packages, either directly or through a graphical tool. APT checks the repositories for new updates and suggests available installations.

To upgrade your system to a new version, the easiest approach is to change the repositories used by APT.

  • Open the sources.list file with your preferred editor (vim in my case):

    sudo vim /etc/apt/sources.list
    
  • If you prefer to use nano, run:

    sudo nano /etc/apt/sources.list
    
  • You will see something like this:

    deb http://deb.debian.org/debian bullseye main contrib non-free
    
  • Edit these lines and replace the current Debian code name (e.g. bullseye) with the one you want to install, for example:

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

    If there are several lines, change all of them the same way (bookworm-security, bookworm-updates, etc.).

  • Save and exit this file (:wq for vim or CTRL+O and CTRL+X if you are using nano).

  • Depending on your system version and installed packages, there may be additional configuration files in /etc/apt/sources.list.d. Edit these files using the same steps as before.

Upgrade your system (with the new repositories)

  • Update the package list:

    sudo apt update
    

    You will notice that all the URLs are now including "bookworm" instead of "bullseye".

  • Then upgrade everything with:

    sudo apt upgrade -y
    
  • Press q to exit the list of changes when it shows up.

    Depending on the packages you have installed, you may be prompted to answer a few questions during the installation (such as whether to overwrite configuration files or restart services). Make sure to pay attention and don't leave the process unattended.

  • After that, I recommend running this other command to install the latest version of everything:

    sudo apt dist-upgrade
    

    While not mandatory, it's generally recommended to ensure all dependencies are up-to-date and properly linked to the latest version during a major upgrade.

    The process is the same: confirm the downloads by typing Y, press q to close the changes list, and then wait a few more minutes for the installation to complete.

  • Downloading and installing all the new packages will take some time. Once the process is complete, it's a good idea to reboot your system to apply all the changes immediately.

    sudo reboot
    

Conclusion

Upgrading to the latest version of Raspberry Pi OS is a great way to keep your system secure and benefit from the latest features and improvements.

By following the steps outlined in this guide, you can easily update your system’s repositories, upgrade all packages, and ensure that your Raspberry Pi is running the most current version. Whether you’re upgrading from an older release or trying out a beta version, this process will keep your system in top shape.

After the upgrade, a simple reboot will apply all the changes, leaving you with a fresh and optimized Raspberry Pi OS.