setup: enable Wi-Fi + fix model download paths + survive SSH session drops - #76
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Raspberry Pi field install setup script to make installs more reliable on fresh images by ensuring Wi‑Fi is enabled before configuring the hotspot, fixing ONNX model download directory structure to match the container mount, and attempting to keep setup running through SSH/Pi Connect session drops.
Changes:
- Add a
trapintended to ignoreSIGHUP/SIGPIPEso the setup script continues running after SSH disconnects. - Introduce
enable_wifi_radio()and invoke it before the hotspot password prompt/setup. - Fix ONNX model download and folder creation paths to include
Models/tritonserver/model_repository/....
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Federico Alves (urucoder)
approved these changes
Aug 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three independent bugs in
sparrow_setup.shthat all surfaced during a series of fresh field installs. Bundled here because all three touch the same file and were found in the same debugging session.Fix 1 — Enable Wi-Fi radio before the hotspot prompt
Some fresh Pi Trixie installs ship with wifi soft-blocked (via
rfkill) or withnmcli radio wifioff. When either is the case,setup_persistent_wifi_hotspotfails with a cryptic NetworkManager error and no clear signal to the operator that they just need to unblock wifi. The fix is one small idempotent helper called before the hotspot config:Both commands exit 0 when wifi is already enabled — safe to run unconditionally on every install.
Fix 2 — ONNX model download paths missing
tritonserver/model_repository/segmentThe container's
LOCAL_MODELS_DIR(insparrow.env) and the bind mount indocker-compose.ymlboth expect models under.../Models/tritonserver/model_repository/<name>/1/model.onnx. But the setup script was downloading all three ONNX models one directory level too high — to\$SYSTEM_FOLDER/Models/<name>/1/model.onnx— so on a fresh installaudio.pylogsAudio ONNX model not found at: /home/sparrow/Desktop/system/Models/tritonserver/model_repository/megadetector_birds_v1/1/model.onnxandinference.pyfails the same way as soon as the first image arrives.Fixed all six occurrences (three
download_model_*functions + three matchingmkdir -pincreate_folders) to include the middle segment. Reference deployment (192.168.1.233) was unaffected because its models were placed manually before the current download step existed — this bug only bites fresh installs.Fix 3 — Survive SSH session drops
sparrow_setup.shrunsset -euo pipefailwith no signal traps. When a Pi Connect / SSH session drops mid-run (extremely common on slow field networks during the multi-minute Docker download), the parent shell dies, sendsSIGHUPto the script, and it terminates silently — no error line in the log, no error on the (now-dead) terminal, no way for the operator to know where it stopped. One line at the top of the script fixes this:HUP= ignore parent shell death.PIPE= ignore broken-pipe from writing to the now-dead terminal. The script keeps running, keeps writing to/var/log/sparrow_setup.log, and the operator can reconnect andtail -fto catch up on progress.Discovered during a real field install where the Docker step died silently after "Reading state information..." with no error. Manual re-execution of every command in
install_docker_pi_debian()succeeded — proving the commands were correct, the failure was just the session being killed by SSH transport.