Upgrade Your Raspberry Pi to Raspbian Buster, Without Losing Data
While it was the launch of the Raspberry Pi 4 that snagged all the headlines this week, it wasn't the only new product to come out of the Raspberry Pi Foundation. The not-for-profit also released a new version of its Raspbian Linux distribution, dubbed 'Buster.' You need Buster to run Raspberry Pi 4, but it also works on and improves the experience for any older Raspberry Pi.
Cutting-Edge
Based on Debian 10 'Buster,' though actually launching a couple of weeks ahead of its upstream distribution, Raspbian 'Buster' brings with it some under-the-hood changes. Chief among these is a switch to a hardware-accelerated desktop environment, though by default this is only active on the new Raspberry Pi 4 with its more powerful VideoCore VI graphics processor. Other core changes are chiefly concentrated around security enhancements, in particular fixes for hardware vulnerabilities known to exist in the Arm Cortex-A72 processor cores of the Raspberry Pi 4.
Speed Demon
Another internal change is in the addition of a USB Attached SCSI Protocol (UASP) driver, in place of the USB Mass Storage (UMS) driver of the old Raspbian 'Stretch.' For those with UASP-compatible external storage devices, the new driver means a boost to transfer speeds and a drop in CPU usage while transferring files. Unfortunately, it's a feature exclusively available to the Raspberry Pi 4: UASP is available only on USB 3.0 or higher, and the Raspberry Pi 4 is the only model to include anything above USB 2.0.
Something for Everyone
Not everything in Raspbian 'Buster' is Raspberry Pi 4 specific, though. The user interface has been overhauled, taking on a new 'flat' look inspired by both desktop and mobile user environments and designed by Simon Long. Even the background picture has been updated, for a warm landscape shot from noted photographer Greg Annandale. There functionality of the Eject icon has been subtly altered, too, hiding by default unless an ejectable storage device is inserted; the same goes for the Bluetooth icon, which is no longer visible on models without radio hardware. Perhaps less welcome is the loss of the live CPU graph from the top-right, though this can be added back by right-clicking and choosing the Add/Remove Panel Items option.
Applications-wise, things are largely as they were in Raspbian 'Stretch,' except for a move away from the IDLE Python integrated development environment to the more user-friendly Thonny. Users of Wolfram's Mathematica will be dismayed to find it missing, but the Foundation assures that this is only temporary: once compatibility issues with the new Raspbian release have been fixed it will be available to install via the Recommended Software tool.
For those looking to upgrade their Raspberry Pis, there are three ways to proceed.
Clean Install
By far the easiest way to upgrade to Raspbian 'Buster' is todownload andflash it onto a microSD card. If you have an existing Raspbian installation, you can Raspbian 'Buster' over the top - but in doing so you'll lose your files, any additional applications you've installed, and any custom settings.
Stay On the Cutting Edge: Get the Tom's Hardware Newsletter
Get Tom's Hardware's best news and in-depth reviews, straight to your inbox.
If you want to maintain these, you have two choices: a clean migration, or an in-place upgrade.
Clean Migration
A clean migration is much like a clean install, but with an intermediate step: moving the /home folder from your old microSD card to the new one. If you're moving to a new microSD as well, flash Raspbian 'Buster' to the new card as above and use a USB card reader to view the drive's contents on your old Raspbian installation; if you're using your existing card, you'll need a USB storage to act as a temporary storage area.
Boot your Raspberry Pi on the existing Raspbian installation, and insert either your Raspbian 'Buster' microSD or temporary storage drive into a USB port. When prompted, click to open it in Raspbian's file manager.
Open a terminal with Control and T, then type the following:
sudo cp -rp /home /media/pi/NAMEOFDRIVE/home
You'll need to replace NAMEOFDRIVE with the actual drive name, visible in the file explorer. If in doubt, just hit the Tab key after typing /media/pi/ and if it's the only removable drive connected it will automatically enter the name; if there is more than one, press the Tab key twice to view a list.
This copies all the files in your Documents, Pictures, and Desktop folders, along with program settings for things like the LibreOffice productivity suite and Chromium web browser. It won't copy any applications you've installed, though; you'll need to reinstall those in Raspbian 'Buster,' but they should at least pick up their original settings.
When the copy is complete, close the terminal window and use the Eject icon at the top-right of the screen to eject the removable drive. If you were copying your files to a Raspbian 'Buster' microSD, you can shut down the Raspberry Pi and swap to the new microSD now and you're done; otherwise, flash your microSD with Raspbian 'Buster,' boot it on the Pi, and insert the temporary storage device to copy the files back again using the command:
sudo cp -rp /media/pi/NAMEOFDRIVE/home /home
In-Place Upgrade
An in-place upgrade maintains all of your applications as well as your files, but isn't always guaranteed to work - especially if the applications in question are no longer supported under Raspbian 'Buster.' Nevertheless, if you want to give it a go, boot your Raspberry Pi with your existing version of Raspbian, open a terminal, and type the following:
grep -rl stretch /etc/apt/ | sudo xargs sed -i 's/stretch/buster/g'
This finds all the source definitions for the apt package manager referring to 'Stretch,' the previous version of Raspbian, and replaces them with 'Buster.' Once finished, type:
sudo apt update && sudo apt dist-upgrade
Note that this process can take several hours to complete, particularly on single-core Raspberry Pi models like the Raspberry Pi Zero family. When it has finished, reboot the Raspberry Pi and launch the Appearance Settings option from the Preferences section of the main menu, click the Defaults tab, and click Set Defaults for your screen size to switch to the new Raspbian 'Buster' user interface design.
Finally, tidy up the now-unsupported applications which have come through from Raspbian 'Stretch' with the following terminal command:
sudo apt purge timidity lxmusic gnome-disk-utility deluge-gtk evince wicd wicd-gtk clipit usermode gucharmap gnome-system-tools pavucontrol