Skip to content

Master Pi

Universal Pi

Silent Boot

Create an empty file called .hushlogin in your users home directory touch ~/.hushlogin

Pipe both stdout and stderr for startx to null if you are not using a display manager. If you want to remove the cursor for the whole Xsession pass -- -nocursor to the startx command. Omit it otherwise (This is handy for heads up displays and photo frames).

startx -- -nocursor >/dev/null 2>&1

If you are mounting your pi's SD card on another computer your cmdline.txt and config.txt are both located in the boot partition. If you are editing them on a running system, they have been moved to /boot/firmware/ and both cmdline.txt & config.txt are located there.

Adjust your cmdline.txt file.

Change the default output tty from tty1 to console=tty3 and add

loglevel=3 quiet splash logo.nologo vt.global_cursor_default=0

Disable rainbow splash screen on boot by editing your config.txt and adding disable_splash=1

If you have setup auto login for the pi user you need to edit the systemd agetty service located at /etc/systemd/system/getty@tty1.service.d/autologin.conf.

Note: You need to leave the empty ExecStart= for whatever reason.

This line is very important to suppress the hostname login: pi (automatic login)" message on boot.

ExecStart=
ExecStart=-/sbin/agetty --skip-login --noclear --noissue --login-options "-f pi" %I $TERM

Newer version of Debian move away from the rc.local file but for certain applications it's still useful. First create the /etc/rc.local file and make it executable chmod +x /etc/rc.local

#!/bin/sh -e
# Add whatever you want here above the exit
exit 0

systemctl daemon-reload and systemctl start rc-local

Editing your pam.d/login to hide other messages can me useful if you are setting up auto login direct to shell, but if launching a Xserver this really isn't needed. Also, updates can revert this change so consider settings up a systemd service that runs before multi-user.target or runlevel: 2

Comment out the following lines

/etc/pam.d/login
session optional pam_lastlog.so
session optional pam_motd.so motd=/run/motd.dynamic
session optional pam_motd.so noupdate

SSD root

Format your SSD with a GPT partition table and place a ext4 filesystem on top. You can mount your SD card and copy the files to your new partition.

mkdir usb
mkdir sd
sudo mount /dev/mmckblkp1 sd/
sudo mount /dev/sda1 usb/

sudo chown -R $USER:users sd/ usb/

sudo cp -ax sd/. usb/

Get your SSDs partition UUID lsblk -o +PARTUUID

Set this value in cmdline.txt under root=PARTUUID=, and set this UUID in /etc/fstab for your / root partition as well.

SSD Storage Quirks

Sometimes an external USB enclosure doesn't play nice with booting. At the beginning of your cmdline.txt add usb-storage.quirks=UUID

You can obtain your USB enclosures UUID by issuing lsub

Bus 002 Device 007: ID 174c:55aa ASMedia. .... ...

The 174c:55aa is your UUID but you need to add the :u to specify user privileges. Your final line will read usb-storage.quirks=174c:55aa:u

Pinouts

Pinout and HATS are all very important. There is a great resource that says it way better here

i2c non root

Add user to i2c group and create udev rule /etc/udev/rules.d/50-i2c.rules

SUBSYSTEM=="i2c-dev", GROUP="i2c", MODE="0660"

Hangs On Boot

If the rpi is hanging on boot with the message random: crng init done.

If running Pi headless at boot the kernel waits for mouse movements to initialize the random number generator.

Install and start haveged to solve this.

sudo apt -y install haveged
sudo systemctl enable haveged

SSH On Boot

Place a empty file named ssh or ssh.txt on the root of your boot partition

Manage WiFi

WiFi On Boot

Place a file on the boot partition named wpa_supplicant.conf and use the template from bellow ⬇️

Check that the WiFi antenna isn't blocked.

sudo rfkill list all

To unblock your antenna use.

sudo rfkill unblock 0

wpa_supplicant

First kill all wpa_supplicant workers and then test your configuration file for errors.

Basic wpa_supplicant template that can be used for either/boot/wpa_supplicant.conf or /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant GROUP=netdev
country=CA
update_config=1

network={
  scan_ssid=1
  ssid=""
  psk=""
}

sudo killall wpa_supplicant

Add -d flag on the end to make it more verbose

sudo wpa_supplicant -c/etc/wpa_supplicant/wpa_supplicant.conf -iwlan0

Pi4

USB Boot Issues

Some firmware in external USB enclosures can cause problems with booting. First step to resolving these issues is to install Raspberry Pi OS on a Micro SD card, boot, and sudo apt update & sudo apt -y full-upgrade. Any firmware upgrades will be performed by rpi-eeprom-update service and applied after next reboot. More information can be found at boot eeprom documentation.

usb-storage.quirks

Booted from your SD card without your external USB enclosure connected run sudo dmesg -C, now plug in the device and run sudo dmesg. The idVendor and idProduct are the two hexadecimal values you require.

Add these two values to the beginning of your /boot/cmdline.txt with usb-storage.quirks.

usb-storage.quirks=aaaa:bbbb:u <-- You must add the :u following your two values.

Reboot the system and check that quirks have been applied.

dmesg | grep usb-storage

Bootloader and Conditional Filters

Bootloader Config

You can find the docs here.

Conditional Filters

You can find the docs here.