Update Raspberry Pi to Debian/Raspbian Stretch 9

Related: Full headless Raspberry Pi setup

Why upgrade 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.

  1. 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.
  2. Download Raspbian Image
    wget https://downloads.raspberrypi.org/raspbian_lite_latest
    
  3. Write Raspbian image to SD card: before and after inserting the SD card into your PC, type
    lsblk
    
  4. Assuming the SD card was at /dev/mmcblk0

    unzip -p *raspbian-stretch-lite.zip | sudo dd of=/dev/mmcblk0 bs=4M
    
  5. This will take 5-10 minutes depending on your SD card speed.
    sync
    

    ensures the writing has completed, then eject the SD card from your PC.

Headless Raspberry Pi first boot

You don’t need a monitor and keyboard, the Avahi dæmon on the Raspberry Pi will make it easy to find your Raspberry Pi when you plug into your LAN.

Note: changing the hostname of your Raspberry Pi also changes the Avahi address correspondingly.

  1. Put the SD card into the Pi, plug an Ethernet cord into your LAN router/switch and from your PC:
  2. Update Pi software
    apt install rpi-update
    rpi-update
    apt update
    apt upgrade
    
  3. Raspberry Pi Configuration
    raspi-config
    

Raspberry Pi reliable long-term install tips

  • avoid overclocking beyond one step above minimum.
  • Use heatsink kit for high-stakes remote operations.

Leave a Comment