Update Raspberry Pi to latest OS

It’s worthwhile to upgrade to Debian Buster 10 to have Python 3.7 with system / GPIO libraries not always easy to install otherwise. It is generally not worthwhile to upgrade the OS in place. Instead, copy off your files, do a fresh Debian install, and copy your files back. Keep the original SD card in case some setup is hard to figure out.

The best way to upgrade the Raspberry Pi operating system is get a new SD card and load the OS from scratch as described below.

Copy any wanted files from Raspberry Pi ~ home directory to your PC with sftp or rsync. This is in case the original SD card fails.

Setup SD card

The contents of the SD card are erased in the following procedure. We suggest getting a new SD card so that you have the original SD card with working configuration in case there’s an issue.

  1. Download Raspberry Pi OS Lite Image

  2. Write the OS image to SD card using [Raspberry Pi Imager]](https://www.raspberrypi.org/software/) or the manual Linux-based process below.

  3. Enable SSH by changing to the SD card boot directory, and type

    • Linux / WSL / MacOS: touch ssh
    • PowerShell: New-Item ssh

Manual Linux setup

If you prefer to manually load the Raspberry Pi SD card image:

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

  2. Assuming the SD card was at /dev/mmcblk0 (use lsblk to find SD card mount point):

    unzip -p *raspios*lite* | sudo dd of=/dev/mmcblk0 bs=4M status=progress conv=fsync

    The option conv=fsync prevents dd from instantly saying it’s done, helping avoid mistakenly removing the SD card before it’s done writing. This will take 5-10 minutes depending on your SD card speed.

  3. Ensure the writing has completed:


Headless Raspberry Pi first boot

Without a monitor and keyboard on the Pi, 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:

    ssh pi@raspberrypi.local
  2. Update Pi software

    apt install rpi-update
    apt update
    apt upgrade
  3. Raspberry Pi Configuration


Raspberry Pi reliable long-term install tips

Avoid overclocking the Raspberry Pi for best long-term reliability. Use a heatsink kit for high-stakes remote operations.