How to Update Raspberry Pi

March 17, 2020

Introduction

Regularly running a Raspberry Pi update ensures optimum performance and security of the device. Bugs in code allow hackers to exploit 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.

Raspbian Buster is the latest version of this OS. Since its release in September, there have been several smaller 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.

How to Update Raspberry Pi User Guide

Prerequisites

  • A Raspberry Pi with Raspbian OS
  • An up to date backup of your files before starting the update
  • A user account with sudo
  • Active internet connection

Update Raspberry Pi

Since Raspbian is based on Debian, you can update Raspberry Pi with the apt tool in a terminal window.

1. Start by updating 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 breaches.

The terminal output for sudo apt update in Raspbian.

2. Before starting the upgrade, you can check the available space on your device. Run the following command:

df -h

3. The upgrade tool tells you how much space it needs to complete the process. To upgrade all packages on your Raspberry Pi, enter this command:

sudo apt full-upgrade
The terminal output for sudo apt full-upgrade in Raspbian

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 Raspbian. This command keeps your current release up-to-date.

4. Let the upgrade finish. Once done, you will get a pop-up confirmation message:

Update confirmation message on Raspberry Pi.

5. If you want to free up some space on your Raspberry Pi, run the clean command to remove the downloaded .deb packages:

sudo apt clean

6. To reboot your device, enter:

sudo reboot

Update Raspbian from an Older Version to Buster

To update Raspbian from an older version (for example, Stretch) to the latest (Buster, at the time of writing), you need to edit a few files.

1. Locate the sources.list file in the /etc/apt/ directory and replace every instance of the word stretch with the word buster. Use the editor of your choice. We will use vi:

sudo vi /etc/apt/sources.list

2. Save the changes and exit the editor.

3. Do the same for the raspi.list file:

sudo vi /etc/apt/sources.list.d/raspi.list

4. When you finish, update your package list:

sudo apt update

5. Then, run this command to complete the upgrade:

sudo apt dist-upgrade

6. The upgrade takes some time. Confirm with yes when prompted. Use the space bar to scroll if the installation shows a page of information and press q to resume the upgrade.

7. Reboot the device when the upgrade completes:

sudo reboot

Confirm Raspberry Pi Update

You can quickly check from the terminal if your Raspbian successfully updated to Buster.

Run the terminal from the application bar and enter:

cat /etc/os-release
Terminal output when you check system version in Raspberry Pi.

Conclusion

By following this tutorial, you learned how to keep your Raspberry Pi updated. This guide also showed you how to upgrade from Raspbian Stretch to Raspbian Buster.

Make sure to update Raspberry Pi frequently to avoid security and performance issues.

If you are looking for other useful Raspberry tutorials, be sure to visit the Java Installation On Raspberry Pi and Ubuntu Mate Installation on Raspberry Pi 2 or 3 guides.

Was this article helpful?
YesNo
Goran Jevtic
Goran combines his leadership skills and passion for research, writing, and technology as a Technical Writing Team Lead at phoenixNAP. Working with multiple departments and on various projects, he has developed an extraordinary understanding of cloud and virtualization technology trends and best practices.
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 Mate on Raspberry Pi 2 or 3
April 8, 2020

This guide lists all the steps necessary to install Ubuntu MATE 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