How to Upgrade Raspbian Stretch to Raspbian Buster

In this guide, we will show you how to upgrade Raspbian Stretch to Raspbian Buster.

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.

sudo rpi-update

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.

Find

deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

Replace With

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“.

Find

deb http://archive.raspberrypi.org/debian/ stretch main

Replace With

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.

sudo reboot

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

20 Comments

  1. Avatar for bart
    bart on

    Thank you very much 😎 it was long to update (about 2 jours) but it worked like a picharm ✌️

  2. Avatar for Juha Kervinen
    Juha Kervinen on

    Just to let you (and others reading this) know that I upgraded one of my PI4s today with these instructions. The upgrade worked perfect, no issues.

  3. Avatar for Daniel
    Daniel on

    Wow. Thanks for this great step-by-step tutorial. I could not install the latest PiHole update because Stretch was no longer supported. Then I found your blog article and everything worked wonderfully, including the firmware update.

  4. Avatar for konsti
    konsti on

    Worked like a charm although I skipped the firmware upgrade, too.
    Many thanks!

  5. Avatar for Jon Magnus
    Jon Magnus on

    Good directions but the firmware upgrade removed all network configuration/interfaces like wlan0/eth0 and I needed to take that back. After that, I continued with the update and it went smooth. Thanks.

  6. Avatar for Clind
    Clind on

    Painless upgrade process following your instructions, I skipped the firmware part as the prompt warned me that it was dangerous and not a standard procedure. It did not affect the ability to successfully perform the upgrade.
    Thanks !

  7. Avatar for Fiji
    Fiji on

    Nice tuto. thanks a lot !

  8. Avatar for Michael
    Michael on

    Excellent! Painless and all of my weird custom Perl and Python code ran fine after the upgrade.

  9. Avatar for Mick
    Mick on

    Took me two beers long to run the upgrade.
    Kodi was still working after.
    LAN was not working, but after restarting and reconnecting it was OK.
    Also my USV (UPS) working on i2c is still working.
    But the HiFiBerry is not working.
    I’m trying to fix this tomorrow.

    Thanks for the tutorial.

  10. Avatar for Fred
    Fred on

    Thank you for this great tutorial! I followed it and upgraded to Buster. Excellent! Many thanks from a newbie. Cheers,

    Fred

  11. Avatar for Claus E. Petersen
    Claus E. Petersen on

    Super nice.
    Short, with examples and explanations.
    Very nice.
    Thank you! 🙂

  12. Avatar for Bernd
    Bernd on

    Great tutorial!
    Thank you for this great thing.
    I was able to remotely upgrade my Raspi through VPN and just using ssh.
    There were some concerns at the beginning…but all went smooth

  13. Avatar for Gerhard
    Gerhard on

    Thanks for this excellent walk-through. I appreciate the explanation to each of the commands and the steps executed!

    Well done 😉

  14. Avatar for BM
    BM on

    Finally a tutorial involving linux that doesn’t skip any steps! 😉
    Worked like a charm. My Pi is updated and Domoticz is still running.

    The set up of this tutorial is really great. It is easy to read, every step is explained and commands are clearly shown. Also the warnings about things to look out for are great.
    I wish all tutorials were like this one.

    Thank you!

    1. Avatar for Steve B
      Steve B on

      I second this. It worked for my Domoticz PI as well. Brilliant. Thank you so much!

  15. Avatar for Graeme
    Graeme on

    A great tutorial, thanks. I followed it step by step had no probems whatever. I must admit I thought I’d blown it during the dist-upgrade phase when I thought it had stalled at 72%. Turns out I hadn’t noticed the prompt. I’ll have to enlarge my font :). Many thanks.

  16. Avatar for Anthony Downie
    Anthony Downie on

    Thank you for this excellent walk through. I followed it and upgraded Stretch to Buster without a hitch, It did then take me some time to figure out the required reconfiguration for my Nextcloud installation, in view of Buster’s addition of PHP7.3 and preference for MariadB, but I was rather expecting that.

  17. Avatar for Malcolm Welch
    Malcolm Welch on

    I’m getting “bash: deb: command not found” What have I done wrong?

    1. Avatar for Emmet
      Emmet on
      Editor

      Hi Malcom,

      You aren’t trying to run the “deb” commands in the command line are you?

      Both are just edits that needs to be made to both the raspi.list file and the sources.list file.

      Cheers,
      Emmet

    2. Avatar for Tony
      Tony on

      Many thanks 👍
      The upgrade is smooth