Upgrading Raspbian Stretch to Raspbian Buster

Marco Franssen /
4 min read • 692 words

In this blog I want to note down in the shortest way possible how to upgrade your Raspberry Pi from Raspbian Stretch to Raspbian Buster.
First check your current version of Raspbian is Raspbian Stretch. The easiest way to do this is enter the following in your terminal.
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
In case it states version 8 (jessie) you can check out following blog first to upgrade first to Raspbian Stretch from Jessie. In case your output is version 9 (stretch) please continue below.
First I ensure at least all patches are installed on my current version. I always do this to reduce risks which might be caused due to very outdated packages.
sudo apt update && sudo apt upgrade
Next I will update my apt sources to use the new buster repos. You could do this manually by replacing stretch
with buster
in your /etc/apt/sources.list.d/*
files, or you simply use below command that replaces it in an very simple straight forward way using sed. With cat you can validate the outcome of the file, just for the sake of your peace of mind.
$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/raspi.list
$ cat /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ buster main ui staging
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ buster main ui
Now you can start to do the upgrade. This might take a couple of hours depending on your network speed. So make sure you have the time to continue on next steps. You will have to confirm and make a choice a couple of times. In my case I also got a broken package which I fixed using the apt --fix-broken install
. You might not face this issue and therefore not require to execute this command.
sudo apt upgrade
sudo apt --fix-broken install #only if you got a broken package install in previous step
sudo apt upgrade-dist
Last but not least as recommended by the guys from Raspberry you can remove the following packages which are installed with Buster, but can't be used on your Raspberry Pi. I also always clean up apt see the second and third command. As we did a distribution update I also give it a reboot.
sudo apt purge timidity lxmusic gnome-disk-utility deluge-gtk evince wicd wicd-gtk clipit usermode gucharmap gnome-system-tools pavucontrol
sudo apt autoclean
sudo apt autoremove
sudo reboot
Last but not least you can now verify your os release, which should now state version 10 (buster).
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
Summary
Summarized it boils down to the following set of commands to upgrade your Raspberry Pi to Raspbian Buster. To do this fully unattended I have added the -y
flag on all commands.
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)"
NAME="Raspbian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
$ sudo apt update && sudo apt upgrade -y
$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list
$ sudo sed -i 's/stretch/buster/g' /etc/apt/sources.list.d/raspi.list
$ sudo apt update && sudo apt upgrade -y
$ sudo apt --fix-broken install #only if you got a broken package install in previous step
$ sudo apt dist-upgrade -y
$ sudo apt purge -y timidity lxmusic gnome-disk-utility deluge-gtk evince wicd wicd-gtk clipit usermode gucharmap gnome-system-tools $ pavucontrol
$ sudo apt autoclean -y
$ sudo apt autoremove -y
$ sudo reboot
Once rebooted you can verify once more your os version, which should now state version 10 (buster).
$ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
References:
Thanks for reading, please share with your friends.