Loading...
Loading...
Marco Franssen

I recently upgraded my Raspberry Pi 3 from Raspbian Jessie to Raspbian Stretch. At the time, security issues affecting the chipsets in the Raspberry Pi 3 and Raspberry Pi Zero prompted me to upgrade to Stretch, which addressed those issues.
Before you get yourself into trouble, back up any important data. Please note that I can't be responsible for data loss. I'll also assume you know how to connect to your Raspberry Pi over SSH and use the command line.
First, check that you're running Raspbian Jessie, since I've tested this guide only when upgrading from Jessie. Use the following command.
cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
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"If you're not running Raspbian Jessie 8.0, I can't guarantee this guide will work. If you're brave enough to continue, let me and the other readers know in the comments whether it works for earlier versions. Once again, make sure your important data is backed up.
Before starting the upgrade, I recommend updating all packages on your existing Raspbian Jessie installation. Run the following commands.
sudo apt update
sudo apt -y upgradeBefore upgrading the distribution, I also updated my Raspberry Pi's firmware with the following command. It updates the kernel, VideoCore libraries, and related components. A reboot is required afterward.
sudo rpi-update
sudo reboot nowNow it's time to prepare for the upgrade to Raspbian Stretch. We need to point APT at the Raspbian Stretch repositories by replacing jessie with stretch in two files: /etc/apt/sources.list and /etc/apt/sources.list.d/raspi.list. You can edit them manually with Vim or use the following commands to replace the text automatically.
sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list
sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list.d/raspi.listWith the APT sources pointing to Raspbian Stretch, we're ready to run the upgrade. This can take a while: it needs to download at least a few hundred MB of new packages. You'll need to answer a few prompts during installation, so check every few minutes to keep things moving. While you wait, consider donating some CPU cycles using the sidebar widget to help cover the site's hosting costs.
sudo apt update
sudo apt -y dist-upgradeAccording to the information on raspberrypi.org, Bluetooth audio support through PulseAudio in Raspbian Jessie was a bit clumsy. Raspbian Stretch improved this by replacing it with bluez-alsa.
With the upgrade complete, it's time to remove PulseAudio. Raspbian Stretch replaces it with bluez-alsa for Bluetooth audio through ALSA. Unless you've built your own setup on top of PulseAudio, you can remove it with the following command.
sudo apt-get -y purge "pulseaudio*"Now it's time to reboot and say a few prayers—or do whatever you do at moments like this, such as grabbing a coffee.
sudo reboot nowAfter rebooting the Pi, I recommend checking once more for updates and removing old packages with the following commands. This saves storage, and I like to keep my servers clean and tidy.
sudo apt update
sudo apt -y upgrade
sudo apt -y autoremove
sudo apt -y autocleanThat's it! Your Raspberry Pi should now be running Raspbian Stretch, with the security patches discussed above. Please share your findings in the comments, and don't hesitate to ask questions. If you're one of the brave readers who backed up before taking the plunge, let us know whether this guide also worked for an earlier Raspbian version.
$ 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"Marco Franssen
Combine separate Git repositories into a multi-module Gradle project while preserving commit history, then consolidate build and CI configuration.
Marco Franssen
Explore responsive and adaptive web design, progressive web apps and how I improved my blog with a static site, caching, manifests and service workers.
Marco Franssen
Learn how to use Docker Compose to build and run a multi-container application, connect services, and organize development with Git submodules.
Marco Franssen
Package a static Angular app in an Nginx Docker image, build it, and run it with port and log volume mappings in this historical 2016 walkthrough.