🛠 Appliance headless durable : root en lecture seule + suivi
Objectives
Make a Zero W "installable and forgettable": the microSD card corrupts upon power loss, and the Zero range does not detect any under-voltage — we lock the system to read-only and monitor it.
Hardware
- 1 Zero W already configured (SSH, Wi-Fi, WLAN)
- Physical access to the SD card for recovery
Steps
- Root on read-only overlayfs:
sudo raspi-config→ Performance Options → OverlayFS (disable swap). - Residual writes in RAM: log2ram or
tmpfson/var/log; the app only writes to its persistent path. - Monitoring probe sent to a collector:
#!/bin/sh
# /usr/local/bin/health.sh — cron : */10 * * * *
{
vcgencmd measure_temp
free -m | awk 'NR==2{print $3" Mo"}'
uptime
} | curl -fsS -T - http://collecteur/zero-w
- Auto-recovery:
systemd-watchdogor@rebootcron that restarts the app — the board restarts cleanly.
Verification
Cut the power abruptly: the board restarts, the app runs, dmesg is clean.
Common Errors
- App database on the overlay: writes disappear upon reboot.
- Under-voltage bit from
get_throttledis blind on Zero: no alert in case of voltage drop.
Other tutorials for this board
Code examples for this board
clignotante.pyPythonbouton-gpio.pyPythoncapteur-i2c.shBashsurveillance-temperature.shBashcapteur-dht11.pyPythonservo-pwm-sysfs.shBash