How to Update Raspberry Pi

December 10, 2024

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.

How to Update Raspberry Pi User Guide

Prerequisites

  • A Raspberry Pi with Raspberry Pi OS.
  • A user account with sudo.
  • Access to the terminal.

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
sudo apt update raspberry pi terminal output

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
df -h terminal output available space

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
sudo apt full-upgrade raspberry pi additional space terminal output

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
sudo rpi-eeprom-update terminal output

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
sudo apt autoremove terminal output free space

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.

Was this article helpful?
YesNo
Milica Dancuk
Milica Dancuk is a technical writer at phoenixNAP with a passion for programming. With a background in Electrical Engineering and Computing, coupled with her teaching experience, she excels at simplifying complex technical concepts in her writing.
Next you should read
How to Install Java on Raspberry Pi
July 18, 2024

This article guides you through the Java installation process on Raspberry Pi. You will also learn how to set...
Read more
How to Install Ubuntu on Raspberry Pi
December 3, 2024

This guide lists all the steps necessary to install Ubuntu on your Raspberry Pi. This includes...
Read more
How to Enable SSH on Raspberry Pi {Linux, Mac OS, Windows}
October 15, 2024

This article shows you how to enable SSH on your Raspberry Pi using different methods. The guide also...
Read more
How to Install Docker on Raspberry Pi
December 12, 2019

If you want to install Docker on Raspberry Pi, that is on its Raspian system, you need to use the automated...
Read more