Upgrading Raspbian OS from Stretch to Buster

With recently released Debian 10 Buster it's possible to upgrade Raspbian OS on your Raspberry Pi device to the same release.
Raspberry Pi 4

Debian 10 Buster got released a while back and this means it should be possible to upgrade Raspbian OS on Rasberry Pi devices to the Raspbian Buster as well. Raspbian OS is based on Debian as you remember.

Step 1: Confirm Your Current Linux Kernel and OS release

Always a good step: confirm Raspbian version and check your current Linux Kernel version:

greys@s7:~ $ uname -a
Linux s7 4.19.42-v7+ #1219 SMP Tue May 14 21:20:58 BST 2019 armv7l GNU/Linux
greys@s7:~ $ cat /etc/debian_version
9.9

Step 2: Update Existing Release Before Upgrading to the Next

Just like in the upgrade Jessie to Stretch procedure, we start with using apt-get command to upgrade existing packages available for the current release.

The reason it’s recommended to do this is by moving to the latest available version in your current release you are minimising the changes required for the upgrade to the next release. Changes and configuration file syntax are not likely to be as dramatic between last version in current release and first version in the next release.

We refresh list of available updates:

greys@s7:~ $ sudo apt-get update

and install these updates:

 greys@s7:~ $ sudo apt-get upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages will be upgraded:
cups-browsed cups-filters cups-filters-core-drivers dbus dbus-x11 fonts-opensymbol libcupsfilters1 libdbus-1-3 libexpat1 libexpat1-dev
libfontembed1 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 libreoffice libreoffice-avmedia-backend-gstreamer
libreoffice-base libreoffice-base-core libreoffice-base-drivers libreoffice-calc libreoffice-common libreoffice-core libreoffice-draw
libreoffice-gtk libreoffice-gtk2 libreoffice-impress libreoffice-java-common libreoffice-librelogo libreoffice-math libreoffice-nlpsolver
libreoffice-ogltrans libreoffice-pdfimport libreoffice-report-builder libreoffice-report-builder-bin libreoffice-script-provider-bsh
libreoffice-script-provider-js libreoffice-script-provider-python libreoffice-sdbc-hsqldb libreoffice-sdbc-postgresql libreoffice-style-galaxy
libreoffice-style-tango libreoffice-systray libreoffice-wiki-publisher libreoffice-writer libssl-dev libssl-doc libssl1.0.2 libssl1.1 libzmq5
nodered omxplayer openssl patch python3-uno raspberrypi-bootloader raspberrypi-kernel rpi-chromium-mods uno-libs3 ure vim vim-common vim-runtime
vim-tiny xxd
65 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 176 MB of archives.
After this operation, 9,103 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
...

Run apt-get dist-upgrade too, in my case it shows zero packages:

greys@s7:~ $ sudo apt-get dist-upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Step 3: Upgrade Raspbian OS to Buster

Three elements to this step:

  1. Update release code name in /etc/apt/sources.list
  2. Download list of available package updates
  3. Upgrade Raspbian OS

Update release name in /etc/apt/sources.list

First, let’s edit /etc/apt/sources.list file:

greys@s7:~ $ sudo vi /etc/apt/sources.list

I changed this:

to this:

Refresh packages info with apt-get update

Now we can refresh information about available package updates:

greys@s7:~ $ sudo apt-get update 

And, finally, we’re ready to…

Upgrade Raspbian packages to Buster release

greys@s7:~ $ sudo apt-get upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
...

… and finish it off with apt dist-upgrade:

greys@s7:~ $ sudo apt-get dist-upgrade
Reading package lists… Done
Building dependency tree
Reading state information… Done
Calculating upgrade… Done
The following packages were automatically installed and are no longer required:
...
The following packages will be REMOVED:
gnome-themes-standard-data gstreamer1.0-omx gstreamer1.0-omx-rpi gstreamer1.0-omx-rpi-config idle-python3.5 libcupscgi1 libcupsmime1 libcupsppdc1
libcurl3 libgles1-mesa libllvm3.9 libmariadbclient18 libreoffice-gtk libreoffice-style-galaxy libreoffice-systray libsensors4 libservlet2.5-java
libtirpc1 netsurf-gtk python3-spidev raspi-copies-and-fills xserver-xorg-video-fbturbo
The following NEW packages will be installed:
...
533 upgraded, 459 newly installed, 22 to remove and 0 not upgraded.
Need to get 861 MB/862 MB of archives.
After this operation, 1,045 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Step 4: Confirm Successful Upgrade

We need to reboot the Raspberry Pi now:

greys@s7:~ $ sudo shutdown -r now

…and run uname -a command and inspect the /etc/debian_version file to confirm that our Raspberry Pi is indeed running the latest version of Raspbian OS now:

See Also




Raspberry Pi OS

While you probably know that Raspbian is the official OS for Raspberry Pi systems, it’s not the only operating system you can use.

In fact, most of Raspberry Pi beginners start with NOOBSNew Out Of Box Software, which is an installer you can download or buy on an SD/microSD card from most of Raspberry Pi vendors.

In addition to this, there’s now a Raspberry Pi Desktop – special distribution that allows you to try Raspbian OS inside a virtual machine or using live USB environment.

See Also




Command to Confirm Raspberry Pi Model

Because I own a number of Raspberry Pi systems, I get roughly the same question quite regularly about each one of them: how can I confirm what this Raspberry Pi model is from the command line? The reason I usually want to know is because the model of the Raspberry Pi hints the Raspbian release that will support it (older Raspbian releases  do not have support for the most recent models of Raspberry Pi).

There’s a few hardware specs like CPU speed and generation, and also a memory size – they used to be helpful in getting the question above answered.

But turns out there’s an even better way: use the model file in the /proc/device-tree directory, like shown below:

$ cat /proc/device-tree/model
Raspberry Pi 3 Model B Rev 1.2

On another server it returns this:

cat /proc/device-tree/model
Raspberry Pi 2 Model B Rev 1.1

Once you confirm the hardware model, consult the Raspbian page on Wikipedia to see Raspbian versions supporting it.

See Also