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 Operating System

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

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.

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

df -h

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.

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

Update confirmation message on Raspberry Pi.

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

To reboot your device, enter:

sudo reboot

Update Raspberry Pi to Buster from an Older Version of Raspbian

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.

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

Save the changes and exit the editor.

Do the same for the raspi.list file:

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

When you finish, update your package list:

sudo apt update

Then, run this command to complete the upgrade:

sudo apt dist-upgrade

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.

Reboot the device when the upgrade completes:

sudo reboot

Check Raspbian Version to 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.

Goran Jevtic
Goran combines his passions for research, writing and technology as a technical writer at phoenixNAP. Working with multiple departments and on a variety of projects, he has developed extraordinary understanding of cloud and virtualization technology trends and best practices.
Next you should read
How to Install Java on Raspberry Pi
April 25, 2020

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}
February 12, 2020

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
  • © 2021 Copyright phoenixNAP | Global IT Services. All Rights Reserved.