Some notes on setting up a fresh Raspberry Pi.

TL;DR Edit 4 files on the SD card before initial powerup:
  • ssh (just create a blank one)
  • cmdline.txt (add option to disabled IPv6)
  • config.txt (edit to enable UART)
  • wpa_supplicant.conf (config to boot with WiFi working)

Newer versions of Raspian (now called Raspberry Pi OS) come with the Serial UART TTL and SSH disabled by default. Enable SSH by adding a file called SSH to the root directory. The Serial UART can be enabled as described in the Adafruit Headless Quick Start by adding a line to the config.txt file on the SD card before inserting into the RPi:

#enable pins 8 (TxD) and 10 (RxD) as serial TTY                               

Reminder for Windows users: Microsoft continues to try to out-think you by automatically adding a ".txt" to files created when right-clicking in Explorer. Check the box "View - File name extensions" in Explorer or use the copy con: ssh command from a DOS prompt (Ctrl-Z to write the file)
The network can be configured in the wpa_supplicant.conf (new file created on SD card) as described in Setting up a wireless LAN via the command line by creating a file called wpa_supplicant.conf: (see docs )

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev                       

Some places will claim to not use quotes . I needed to use them around ssid, but not on psk.
The  wpa_supplicant.conf file will be copied to /etc/wpa_supplicant/wpa_supplicant.conf and the removed from the boot directory at RPi startup time. cmdline.txt file and add ipv6.disable=1
If you want to use a psk instead of a plain text password, and for some reason don't have a linux box or WSL to run wpa_passphrase "YOURSSID" (installed with sudo apt install wpasupplicant) there's a Wireshark page that will do the conversion .
We'll also (optionally) install log2ram as described in my prior blog on the Pi-Hole notes.

sudo rfkill unblock wlan
sudo apt-get update
sudo-apt-get upgrade --assume-yes
sudo apt-get install fail2ban --assume-yes
# log2ram install (optional)
cd ~/
curl -Lo log2ram.tar.gz
tar xf log2ram.tar.gz
cd log2ram-master
chmod +x && sudo ./

I saved these 4 files and simply copy them to the root of the CD card when burning a new image for a fresh Raspberry Pi setup.

Copyright (c) gojimmypi all rights reserved. Blogger Image Move Cleaned: 5/3/2021 1:35:54 PM