The Raspberry Pi 4B first launched late in June 2019, and with it came a new version of Raspbian, the Raspberry Pi’s official operating system. Not long after, Debian, the operating system Raspbian is based on, also released its latest version, Debian 10 Buster.
Thanks to the framework already in place from Debian, upgrading the Raspberry Pi’s operating system is very simple. Plus, if you’re looking to use an existing Raspbian install on a new Raspberry Pi 4, you can, once it’s upgraded to Buster.
Update the Pi
Before you upgrade the Pi, it’s a good idea to make sure that the existing Raspbian install is entirely up to date. The shorter the distance between software versions in the upgrade, the better. Making large leaps forward can cause conflicts that can’t easily be solved and may break things permanently. Raspbian is designed to move seamlessly from a fully updated Stretch install to Buster, so that’s the best route to take.
Access your Pi. If you have a monitor, this part’s easy. Just open a terminal. If you’re running a headless Pi, you’ll need to SSH in. Windows 10 users can use the built-in OpenSSH functionality that it provides. If you’re on Mac or Linux, you can open a terminal and use SSH.
ssh pi@raspberrypi
Then, run an update and upgrade on the Pi as it sits.
sudo apt update && sudo apt upgrade
That may or may not take some time, depending on how outdated the Pi is. Confirm the package install, and wait as it completes. When it’s done, it may be a good idea to reboot the Pi and reconnect to make sure you’re running the latest kernel on the system.
sudo reboot
Change the Sources File
Once the Pi comes back online and you reconnect, you can get to work setting the Pi up for an upgrade. Raspbian, like Debian, uses a configuration file at “/etc/apt/sources.list” to control its software repositories. That file also specifies which version of the operating system to pull packages for. So changing that file to use Buster instead of Stretch will enable Raspbian to upgrade itself.
Using the Pi’s Nano text editor, open the sources configuration.
sudo nano /etc/apt/sources.list
The file should look something like the image below.
Go through the file and change everywhere it says “Stretch” to “Buster.” The end result will look like the image below.
Save the file and exit.
Run the Distribution Update
With the file in place, you can run a distribution update on the Raspberry Pi to download all the packages and formally change over to the new version, Buster. Run the command below in the Pi’s terminal to kick off the process.
sudo apt update && sudo apt dist-upgrade
After updating the repositories and assessing the required packages, the package manager will ask you if you want to install the new packages, effectively upgrading to the new release. Confirm to start the upgrade.
This will take some time, especially on an older version of the Pi or one connecting over Wi-Fi. Be patient and wait for the whole thing to finish. It’ll let you know when it’s done.
Reboot and Test It Out
Before you can start using Raspbian Buster, you’re going to need to reboot the Pi again.
sudo reboot
After the Pi comes back online, access it again. You can run the following command to make sure that you’re running Buster.
cat /etc/*-release
If that comes back like the image, you’re running Buster on your Raspberry Pi, and everything is fully updated. You can now seamlessly transfer your microSD card into a Raspberry Pi 4, or you can keep on using it normally in your current Pi with updated software.
Our latest tutorials delivered straight to your inbox