Introduction
Regularly updating a Raspberry Pi ensures optimum performance and security. Updates help resolve bugs in code and reduce the possibility of exploits on your Raspberry Pi. These known vulnerabilities pose a significant threat, especially if a device is connected to the internet or if you access it remotely.
Raspberry Pi OS is a Debian-based system that receives regular updates. A Raspberry Pi update can include improvements to the bundled software, security patches, and other performance-related enhancements.
Follow this tutorial to learn how to update your Raspberry Pi in a few simple steps.
Prerequisites
Update Raspberry Pi OS
Since Raspberry Pi OS is a distribution based on Debian, update Raspberry Pi with the apt tool in a terminal window:
1. Open the terminal and update the repository package list:
sudo apt update
Note: If you are using the default user account pi, the password is raspberry. We advise you to change the password to avoid potential data breaches.
2. Before upgrading, check the disk space on your device. Run the following command:
df -h
Confirm there is enough available space on the root partition or the appropriate location if installing in a different location.
3. To upgrade all packages on the Raspberry Pi, run:
sudo apt full-upgrade
The command shows how much space the upgrade requires. Press y to accept and continue the installation.
Note: The apt full-upgrade
and apt-get distro-update
command perform the same function. apt full-upgrade
does not update to a new major release of Rasberry Pi OS. This command keeps your current release up-to-date.
4. Let the upgrade finish. When it completes, reboot the device:
sudo reboot
The reboot applies any final changes to the system.
Update Raspberry Pi Bootloader
Raspberry Pi automatically updates the bootloader to the latest stable version through the package repository. However, if the beta version is not yet pushed and it would resolve some system issues, update the bootloader manually:
1. Check if there are available updates:
sudo rpi-eeprom-update
The command uses the rpi-eeprom package, which updates Raspberry Pi 4 and 5 bootloaders.
2. To update the bootloader, run the following command:
sudo rpi-eeprom-update -a
The -a
option applies any available updates.
3. To apply the changes, restart the device:
sudo reboot
The bootloader changes apply after the restart.
Clean up Unnecessary Packages
After updating the system, clean up any unnecessary and leftover packages that were left from the process:
1. Use the autoremove
command from the APT package manager:
sudo apt autoremove
The command searches for and removes packages that were installed but are no longer required.
2. Use the clean
command to clean up the package archive cache:
sudo apt clean
The command cleans up the cache from any leftover files.
Conclusion
This guide showed how to update the Raspberry Pi operating system and package repositories. Update the device frequently to avoid security and performance issues.
For more Raspberry tutorials, see Java Installation On Raspberry Pi or Ubuntu Installation on Raspberry Pi guides.