In this guide, we will show you how to upgrade Raspbian Stretch to Raspbian Buster.
Raspbian Buster is the latest release of the Raspbian operating system. This release brings numerous behind the scenes fixes as well as access to more modern packages.
Updating to Raspbian Buster is a reasonably straightforward process and mainly requires modifying two simple files and then running an upgrade.
Before upgrading your Raspberry Pi from Raspbian Stretch to Buster you should first make a backup of your SD Card. There is always a chance that this upgrade process will break your existing installations.
If you have some critical software running on your Raspberry Pi, it’s best to do a quick search to ensure there aren’t any compatibility issues on the latest release.
Preparing Raspbian Stretch for Buster
1. We need first to ensure that our current Raspbian operating system is entirely up to date.
Upgrading all the currently installed packages ensures that we will have a cleaner upgrade path to Raspbian Buster.
Let’s first update all the currently installed packages by running the following command.
sudo apt update sudo apt dist-upgrade -y
We utilize “dist-upgrade” instead of the plain “upgrade” command to force Raspbian to upgrade to the latest available versions of all packages regardless of whether they need to update.
2. Next, let’s go ahead and also update the Raspberry Pi’s firmware.
We can do that by running the command below on our Raspbian installation.
Once all the update processes have completed, we can now proceed to upgrade the Raspbian installation from Stretch to Raspbian Buster.
Updating Raspbian Stretch to Raspbian Buster
1. Now that we have prepared our Raspbian Stretch installation, we can now start the process of moving to Buster.
To do this, we will need to modify the “/etc/apt/sources.list” file.
Begin modifying the sources file by running the following command.
sudo nano /etc/apt/sources.list
2. Within this file, find the following line and change “Stretch” to “Buster“.
This change will allow the package manager to search the Raspberry Pi package repository under the “Buster” distribution instead of the “Stretch” distribution.
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
Once you have replaced all occurrences of “stretch” within the file you can save it by pressing CTRL + X then Y followed by ENTER.
3. Next we also need to modify the “/etc/apt/sources.list.d/raspi.list” file by running the following command.
sudo nano /etc/apt/sources.list.d/raspi.list
4. In this file, you need to go ahead and find the following text and change “Stretch” to “Buster“.
deb http://archive.raspberrypi.org/debian/ stretch main
deb http://archive.raspberrypi.org/debian/ buster main
Once you have again finished switching “Stretch” to “Buster“, you can save the file by pressing CTRL + X then Y and then ENTER.
5. Now before we do the final push to Raspbian Buster, we will first remove the “apt-listchanges” package.
The reason for removing this package is to give us a faster and smoother upgrading process. Without removing this package, the Raspbian operating system will have to load a fairly large changelog file which will slow down your upgrade process considerably.
Feel free to re-install this package after the upgrade process has completed.
Run the command below to uninstall the “apt-listchanges” package.
sudo apt-get remove apt-listchanges
6. Finally, with the source files now modified to mention the “Buster” build instead of “Stretch” we are now ready to begin the upgrade process.
The first command will update the package lists stored on the Raspberry Pi. The second command will then update all the packages to their Raspbian Buster versions.
sudo apt update sudo apt dist-upgrade
Please note that this process can take considerable time as there are a fair few packages that will need to be updated.
Additionally, you may be required to answer prompts, so don’t stray too far from your Raspberry Pi.
7. Once the Buster upgrade process has completed, we will need to get rid of some new applications that will automatically be installed.
These packages are not supported by the Raspberry Pi foundation and are recommended to be removed.
We can remove these packages by running the following command on your Raspberry Pi.
sudo apt purge timidity lxmusic gnome-disk-utility deluge-gtk evince wicd wicd-gtk clipit usermode gucharmap gnome-system-tools pavucontrol
8. Next, we need to run a few more commands to ensure we have cleaned up everything leftover from the upgrade.
The first command that we will be running is the package managers “autoremove” command. This command will remove any packages that have been marked as no longer needed due to changed dependencies.
Run the following command to remove these no longer required packages.
sudo apt autoremove -y
9. Now we need to run the apt package managers “autoclean“.
This autoclean command will clear out the package cache. It automatically removes any package files that are no longer available for download and thus are largely useless.
Use the command below to begin the cleaning process.
sudo apt autoclean
10. The final thing we should do is restart our Raspberry Pi. Restarting ensures that the Raspberry Pi will load in all the new Buster packages and clear out any old data sitting in memory.
Run the following command to reboot the Raspberry Pi.
At this point, you should now have successfully updated your Raspberry Pi from Raspbian Stretch to Raspbian Buster. You can now go do some more projects using the Raspberry Pi using your newly updated version of Raspbian.