Updating Raspberry Pi to Debian/Raspbian Stretch 9

Related: Full headless Raspberry Pi setup

Recommendations for Upgrading Raspberry Pi to Debian/Raspbian Stretch 9

It’s worthwhile to upgrade to Debian Stretch 9, to go from system Python 3.4 to 3.6, get QT5, etc. I found it was not worthwhile to upgrade Raspbian in place, as it took several hours and filled my 8 GB SD card. The best way to upgrade the Raspberry Pi operating system is to wipe (erase) the SD card and reload with Debian/Raspbian from scratch as described below.

0. Backup your Raspberry Pi data

Backup your Raspberry Pi ~ home directory to your PC with sftp or rsync. The contents of your SD card are erased in the following procedure.

1. Download Raspbian Image

wget https://downloads.raspberrypi.org/raspbian_lite_latest

2. Write Raspbian image to SD card

Before and after inserting the SD card into your PC, type

lsblk

The new /dev/mmcblk* that appears should be your SD card, verify the size, you don’t want to erase your hard drive with the next step! Let’s imagine you determined the SD card was at /dev/mmcblk0, then:

unzip -p *raspbian-stretch-lite.zip | sudo dd of=/dev/mmcblk0 bs=4M

This will take 5-10 minutes depending on your SD card speed. Type

sync

to be sure the writing has completed, then eject the SD card from your PC.

3. Boot and connect to your Raspberry Pi

You don’t need a monitor and keyboard, the Avahi daemon on the Raspberry Pi will make it easy to find your Raspberry Pi when you plug into your LAN. Put the SD card into the Pi, plug an Ethernet cord into your LAN router/switch and from your PC type:

Update your Pi software

apt install rpi-update
rpi-update
apt update
apt upgrade

Raspberry Pi Configuration

raspi-config

If you’re using the Pi in a long-term installation, I would avoid overclocking beyond one step above minimum. Consider some kind of heatsink kit for high-stakes remote operations.

Leave a Comment