Skip to content

Instantly share code, notes, and snippets.

@agrif
Created July 14, 2025 20:23
Show Gist options
  • Save agrif/375c46935731834910b8b7653486e966 to your computer and use it in GitHub Desktop.
Save agrif/375c46935731834910b8b7653486e966 to your computer and use it in GitHub Desktop.
* Install Pi OS lite 64-bit, with hostname, agrif user, locale.
* modify /boot/firmware/config.txt, put the following under [all]:
# serial console (see also cmdline.txt)
enable_uart=1
# pisugar RTC on i2c address 0x68
dtoverlay=i2c-rtc,ds3231
* use serial console for now
* rip out NetworkManager
$ sudo systemctl mask NetworkManager.service NetworkManager-dispatcher.service NetworkManager-wait-online.service1
$ sudo apt-get remove network-manager
$ sudo apt-get purge network-manager
$ sudo apt-get autoremove
* turn on networkd
$ sudo systemctl enable systemd-networkd
$ sudo systemctl start systemd-networkd
* get wlan0 up and working
$ sudo systemctl stop wpa_supplicant
$ sudo systemctl disable wpa_supplicant
install -m0600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
install /etc/systemd/network/50-builtin-wifi.link
install /etc/systemd/network/50-usb-wifi.link
install /etc/systemd/network/20-wlan0.network
make sure between 50-usb-wifi.link and 50-builtin-wifi.link that
the right adapters are named ap0 and wlan0
$ sudo systemctl enable wpa_supplicant@wlan0
$ sudo rfkill unblock wlan
$ sudo reboot
* get ap0 up and working
install /etc/systemd/network/30-ap0.network
$ sudo apt-get install hostapd
install -m0600 /etc/hostapd/ap0.conf
$ sudo systemctl enable [email protected]
plug in wifi adapter
$ sudo rfkill unblock wan
$ sudo reboot
* use resolved
$ sudo apt-get install systemd-resolved
$ sudo systemctl enable systemd-resolved
$ sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
$ sudo reboot
* get sshd configured and working
$ sudo systemctl enable ssh
$ sudo systemctl start ssh
install ~/.ssh/authorized_keys
install ssh_host_*_key* to /etc/ssh (mind permissions)
install into /etc/ssh/sshd_config.d: (mind owner)
50-no-passwords.conf, 50-no-root.conf
$ sudo systemctl restart ssh
* move to ssh
* copy over rest of ~/
* set up watchdog
modify /etc/systemd/system.conf
RuntimeWatchdogSec=60
RebootWatchdogSec=2min
* set up wireguard
$ sudo apt-get install wireguard
install /etc/wireguard/wg0.conf (mind permissions)
install /etc/systemd/system/wireguard-reresolve-dns.{service,timer}
$ sudo systemctl enable wg-quick@wg0 wireguard-reresolve-dns.timer
$ sudo reboot
* set up msmtp
$ sudo apt-get install msmtp msmtp-mta
install /etc/msmtprc
msmtp <to-addr> # do a test email
* gps causes recent kernels (6.12.25+rpt-rpi-v8) to crash with no panic
https://github.com/raspberrypi/linux/issues/6955
so, use a different usb driver
modify /etc/firmware/config.txt, under [all] add:
dtoverlay=dwc2,dr_mode=host
* set up gps
install /usr/local/bin/gpsd-location
install /etc/udev/rules.d/99-gps-custom.rules
$ sudo apt-get install gpsd python3-click
modify /etc/default/gpsd
DEVICES="/dev/tty.gps"
GPSD_OPTIONS="--listenany"
USBAUTO="false"
install /etc/systemd/system/gpsd.socket.d/override.conf
$ sudo systemctl disable gpsd.socket
$ sudo reboot
* install pisugar software then board
install /usr/local/bin/pisugar-stats
$ sudo apt-get install i2c-tools
$ sudo raspi-config # and enable i2c under "Interfacing options"
get and install pisugar-{server,programmer,poweroff}_arm64-gnu.deb
(it's a PiSugar 3)
$ sudo systemctl disable pisugar-poweroff.service
$ sudo systemctl mask pisugar-poweroff.service
install /usr/lib/systemd/system-shutdown/pisugar-poweroff.sh
modify /etc/default/pisugar-poweroff to put OPTS in "quotes"
$ sudo reboot
install the pisugar 3 board
in webui (hyperion:8421) enable:
wake on power restore
buttons none
battery input protection, anti-mistouch, soft shutdown (shutdown) on
sync rtc
modify /etc/pisugar-server/config.json (confirm in webui on restart):
"auto_shutdown_level": 60.0,
"bat_protect": true,
at this point, test pisugar boot and shutdown
* iphone tethering
install /etc/systemd/network/50-usb-iphone.link
install /etc/systemd/network/10-tether0.network
install /etc/systemd/system/systemd-networkd-wait-online.service.d/override.conf
$ sudo apt-get install libimobiledevice-utils usbmuxd
unlock iphone, plug in, hit "trust", then run
$ sudo idevicepair pair
might need to reboot, might need to reboot phone
* uptime warning
install /etc/systemd/system/uptime-warning.{service,timer}
$ sudo systemctl enable uptime-warning.timer
$ sudo systemctl start uptime-warning.timer
* tpms: in ~/tpms-ble,
$ rm -rf local/hyperion-env
$ python3 -m venv local/hyperion-env
$ local/hyperion-env/bin/pip install -r requirements.txt
$ local/hyperion-env/bin/python -u tpms.py
# success outputs tpms messages, if it sees any. maybe test this.
* telegraf
install via instructions on site, but use
/etc/apt/keyrings/influx-data.gpg
/etc/apt/sources.list.d/influx-data.list
install into /etc/telegraf/telegraf.d:
bifrost-db.conf, common-extra.conf, gpsd-extra.conf,
hyperion-extra.conf, pisugar-extra.conf, rpi-extra.conf
$ sudo usermod -aG video telegraf
$ sudo apt-get install lm-sensors
$ sudo systemctl restart telegraf
* radio stuff
install /etc/udev/rules.d/99-ham-custom.rules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment