In this guide, you will be learning how to update the Raspberry Pi.
Updating the Raspberry Pi is a task that you should complete regularly. It helps ensure that your device runs at its best and improves the overall security of your device.
Packages are regularly updated with the latest bug and security fixes long after the initial release of an operating system update.
If you remotely access your Raspberry Pi using SSH or VNC, it is even more crucial to maintain a regularly updated system.
Luckily updating the Raspberry Pi is a relatively straightforward process, especially when using the official operating system.
In addition to showing you how to update your Pi’s OS, we will also be walking through the steps of updating to the latest pre-release firmware.
Update the Raspberry Pi’s Operating System
One of the easiest things to do is to update the Raspberry Pi’s operating system.
Most operating systems that people utilize on the Pi are based on Debian, including the official Raspberry Pi OS and Ubuntu Server.
Debian-based systems utilize the apt
package manager, so update packages are reasonably straightforward.
The following commands will all need to be run within the terminal. You can use CTRL + ALT + T to open the terminal quickly if you are using the desktop interface.
1. Our first step is to update the Raspberry Pi’s package list.
The package manager uses the package list to know what packages need updating and where it can download them. It polls package repositories for these lists.
Run the following command on your device to update the package list.
sudo apt update
If you have errors indicating that it failed to connect to a package repository, you can try using a different mirror.
2. Once the package list has been updated, we can run a full upgrade on any available package.
To update any available packages, you can run the command on your Raspberry Pi.
sudo apt full-upgrade
By running a full upgrade, the apt package manager will install any additional dependencies software might require.
3. When running this command, you prompted if you would like to continue with the update.
To continue with the package upgrade process, type in y, then press the ENTER key.
4. If specific packages were updated, such as the Raspberry Pi’s kernel, you will need to restart your device for the changes to take effect.
To restart the Raspberry Pi, all you need to do is use the following command.
sudo reboot
Cleaning Up After an Update
After an update, you may want to clean up any remnants caused by the upgrade process.
Downloaded packages are all stored within a cache on your device. This cache may even include packages that are no longer available for download.
Additionally, during a full update of your Raspberry Pi, some packages may no longer be needed by the system. We can also use these steps to clean up these leftover packages.
2. Let us start by using the “autoremove
” argument for the apt package manager.
This command will search for any packages that were installed but are no longer required and uninstall them.
sudo apt autoremove
2. After the package manager finishes removing these packages, we can clean up the package archive cache.
To clean up the cache, all we need to do is run the following command.
sudo apt clean
Manually Updating the Raspberry Pi’s Bootloader
It is possible to update to the latest preview version of the Raspberry Pi’s bootloader.
Typically you should only do this if you are experiencing particular troubles with your Raspberry Pi that have been solved with a BETA build.
Once the bootloader has become stable, it will be automatically pushed through the Raspbian package repository. Most people should wait for the update to become available through this method.
You can check out the latest changes to the Pi’s bootloader on their GitHub.
1. Please note that you will be potentially installing an unstable version of the bootloader by following the next steps.
Only perform this update to your Raspberry Pi if you know the potential problems that could arise from a buggy bootloader.
2. You can check to see if any updates are available by running the command below.
sudo rpi-eeprom-update
This command will detect your Raspberry Pi’s current bootloader version and let you know if there is an available update.
If an available update has been detected, you can move on to the next step.
3. We can run the following command on your device to update the Raspberry Pi’s bootloader.
sudo rpi-eeprom-update -a
The “-a
” argument tells the rpi-eeprom-update
tool that we want to apply any available updates.
4. For the bootloader changes to take effect, you will need to restart your device.
You can restart your Pi by using the command below on the device.
sudo reboot
Conclusion
Hopefully, at this stage, you will know how to update your Raspberry Pi’s operating system.
Updating often is crucial to maintaining the security and performance of your device.
If you want to upgrade your operating system from a major version, we have guides on that as well. You can upgrade from Wheezy to Jessie, Jessie to Stretch, Stretch to Buster, Buster to Bullseye, and Bullseye to Bookworm.
Additionally, it is also possible to configure your system so that it will automatically install security upgrades.
If you have run into any issues, feel free to leave a comment below.
Now that you know how to keep your system updated, check out some of our great Raspberry Pi projects.
Thanks for this guide! I’m making a “hard copy” for reference….
Hi, I used your Plex server a while ago and now some of the repositories are outdated. How do I fix this? Thanks!
Hi Andrew,
Having a quick glance over the error you are running into; it appears that is being caused by the official Raspbian repository dropping Stretch completely. Stretch was released back in 2017 and they have since gone from Stretch, to Buster, to Bullseye, to Bookworm (Latest).
I would personally recommend backing up any personal data and start fresh on a new release of Raspberry Pi OS Bookworm. Enough has changed since the Stretch days that an upgrade would be a very painful process.
Kind regards,
Emmet