Quick start with Raspberry Pi

A quick, or if you will TL;DR version, step-by-step guide for getting up and running with a Raspberry Pi with Raspberry Pi OS using the Lite release.

This is the way.

Raspberry Pi 3 A+

Preparing SD card with OS for a Raspberry Pi, the TL;DR version

You do not need any fancy GUI tools to prepare a SD card. This is a short, to the point, no-gui, quick start guide on how to prepare a SD card with the Raspberry PiĀ  Operating System image for your Raspberry Pi.

  1. Downloading the OS image
  2. extracting the image and
  3. writing to the SD card from the command line.
  4. Configure the image, add a user, enable ssh, etc

As It Should Be Done.

Download the Raspberry Pi OS image

Download the release OS image you would like to use. The example below is for the 64-bit Lite release.

wget https://downloads.raspberrypi.org/raspios_lite_arm64/images/raspios_lite_arm64-2022-09-26/2022-09-22-raspios-bullseye-arm64-lite.img.xz

Write image to SD card

The only tool you need for writing the image to an SD card is dd. No need for any bloated GUIs.

Unpack the SD image file with unxz

unxz 2022-09-22-raspios-bullseye-arm64-lite.img.xz

Determine the SD card device node

This depends on what kind of SD card reader you are using, in our example we use an USB Multi card reader. The device name is probably something else on your system, change sdf in the example accordingly. Make absolutely sure you are using the correct device!!!

lsblk
...
sdf                    8:80   1  29,1G  0 disk  
...

Or

lsblk -S
NAME HCTL       TYPE VENDOR   MODEL                   REV TRAN
sda  0:0:0:0    disk ATA      KINGSTON_SUV400S37240G D6SD sata
sdb  3:0:0:0    disk ATA      ST1000NM0011           PT0D sata
sdc  4:0:0:0    disk ATA      WD1002FBYS-12          0300 sata
sdd  10:0:0:0   disk Seagate  Expansion_HDD          1801 usb
sde  8:0:0:0    disk ATA      CT1000BX500SSD1        054  sata
sdf  9:0:0:0    disk          Multi-Reader_-0        0031 usb
sr0  7:0:0:0    rom  hp       hp_DVD_RW_AD-7251H5    1H8D sata

Write the image to the SD card

Write the image to SD card with dd

dd if=2022-09-22-raspios-bullseye-arm64-lite.img of=/dev/sdf bs=4M status=progress

Re-read partition table

partprobe /dev/sdf

Additional preparations, mount the SD card

Mount the boot partition from the SD card

mount /dev/sdf1 /mnt

Add initial user(s)

The OS image does not come with a default user anymore. Or password. You need to add that yourself by creating a userconf file in the boot partition. Highly annoying if you are working headless. The example below adds a pi user with the password YourFavoritePassword.

(echo -n pi: ; echo 'YourFavoritePassword' | openssl passwd -6 -stdin) | sudo tee /mnt/userconf

You can add as many more users you like, with whatever username/password combo you like.

(echo -n another: ; echo 'YourOtherPassword' | openssl passwd -6 -stdin) | sudo tee -a /mnt/userconf

Enable SSH

touch /mnt/ssh

Unmount, insert card and boot your Pi

Un-mount the boot partition

umount /mnt

Eject the SD card

eject /dev/sdf

Insert the SD card into your Pi and boot up.

After first boot

The images tend to be "old", so make sure you do the apt upgrade dance after the first boot:

sudo apt update && sudo apt upgrade -y