2.1.1 Setup Operating System onto the Raspberry Pi

Download the image

I would recommend a 64-bit system, as Raspberry Pi 3B, 3B+ and 4B are 64 bit hardware.

Raspberry Pi Foundation provides a suitable system at https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-64-bit . I would recommend “Raspberry Pi OS Lite” 64-bit. The latest one was released April 4th 2022.

Write to micro-SD card

With this release, the default user pi was removed!
I would suggest to setup the user scanner - see https://www.raspberrypi.com/news/raspberry-pi-bullseye-update-april-2022/
Also don't forget to activate SSH daemon for remote (headless) setup.

You might follow the setup instructions at https://www.raspberrypi.com/software/

Details for writing from a Linux PC

check and verify your micro-SD cards' device name

verify to have the correct device name for the (new) SD card
for not overwriting and trashing your system
or overwriting relevant data!

check for existing block devices with lsblk - before inserting the SD card to be written.

on another terminal (SSH-session), you may check dmesg -w while inserting

re-execute and compare output of lsblk to previous output

optionally, you might check existing contents by mounting - replace /dev/sdb with YOUR device!
but keep the digit after /dev/sdb, e.g. /dev/sdb1 is changed into /dev/sdc1

sudo fdisk -l /dev/sdb # lists partitions
mkdir /dev/shm/sdb1
sudo mount /dev/sdb1 /dev/shm/sdb1

check the contents, e.g. with cd, ls, .. or mc and then unmount each checked partition

sudo umount /dev/shm/sdb1

(over)write the micro-SD card

don't forget to replace /dev/sdb with YOUR micro-SD cards' device name!

xzcat 2022-04-04-raspios-bullseye-arm64-lite.img.xz | sudo dd bs=4M of=/dev/sdb
sync

unplug / eject the micro-SD card with the adapter

prepare auto-generating user and SSH activation

re-insert micro-SD card and mount
again: replace /dev/sdb with YOUR device!

sudo fdisk -l /dev/sdb
mkdir /dev/shm/sdb1
sudo mount /dev/sdb1 /dev/shm/sdb1

we need an enctypted version for the password scanner123 - you might change in following

echo 'scanner123' | openssl passwd -6 -stdin

there comes a huge alphanumeric string. copy it into your clipboard - or select for pasting with middle mouse button.

for later automatic generation of user scanner - you might change in following

echo 'scanner:$6$6t.t7wG2IkuS0IHn$COM.bQQWWbTYtLCkLf5Mk6PUUnpkZN7R0JLsXwUfHDPx6Hc0jK77Ci28zR01rdyN.1jRQGuHnP1rq78I0xzF.0' >/dev/shm/sdb1/userconf.txt

and for later activation of SSH-daemon

touch /dev/shm/sdb1/ssh

you might setup / change other bootup options for the Raspberry Pi, e.g. display options, ..

when finished, unmount

sudo umount /dev/shm/sdb1

and unmount the micro-SD card from the PC

now, you are ready to insert the prepared SD card into the Pi and boot from it. using Pi headless over Ethernet network, you might lookup the IP address; the default hostname is raspberrypi

SSH Software hints

On a Windows PC, you can use one of the following programs to establish an SSH connection

PuTTY: https://www.putty.org/

MobaXterm: https://mobaxterm.mobatek.net/

Windows Subsystem for Linux (WSL/LXSS) with Windows 10

for sure, there are other alternatives. i would recommend MobaXterm, which has a builtin X-server, that would allow to run GUI programs.

if really necessary, i would suggest JuiceSSH (https://juicessh.com/) for SSH from an Android smartphone or tablet.

System Update & Configuration

Please continue with 2.2 Setup on a pre-installed Pi or PC

afterwards, check other configuration options - special for Raspberry Pi, e.g. speaker output:

sudo raspi-config