Skip to content

setup: robust uuidgen install on Trixie + XBee-PRO 900 family support - #75

Merged
Federico Alves (urucoder) merged 2 commits into
mainfrom
fix-install-uuidgen-trixie
Aug 7, 2026
Merged

setup: robust uuidgen install on Trixie + XBee-PRO 900 family support#75
Federico Alves (urucoder) merged 2 commits into
mainfrom
fix-install-uuidgen-trixie

Conversation

@Clamps251

Copy link
Copy Markdown
Collaborator

Two independent field-reported failures in sparrow_setup.sh on a fresh SPARROW build; both fixes bundled here because they land in the same script.

Fix 1 — install_uuidgen() cryptic failure on Trixie

The operator hit E: Package 'uuid-runtime' has no installation candidate mid-setup and had no way to know what went wrong. Root cause: their Pi's /etc/apt/sources.list is misconfigured (most likely missing the main component or set to the wrong suite). uuid-runtime is the canonical package for uuidgen on all current Debian releases (verified on a working Trixie Pi at 192.168.1.233 — dpkg -S /usr/bin/uuidgen returns uuid-runtime, and util-linux does not ship uuidgen).

Changes:

  • Guard apt install uuid-runtime with an if so set -euo pipefail doesn't abort before we log a diagnostic.
  • On failure, print a targeted error naming the exact sources.list line the operator likely needs.
  • Verify command_exists uuidgen at the end and return 1 if still missing — script fails cleanly with the operator seeing full context instead of a cryptic apt message.

Fix 2 — XBee-PRO 900 support (AT BR bug)

The same operator's XBee radio caused xbee_configure.py to die with [ERROR] ATBR1 failed, response: 'ERROR'. Root cause: BR (RF data rate) is only a valid AT command on the XBee SX 868 family. On XBee-PRO 900 / 900HP the RF rate is fixed by the firmware image loaded on the module (Digi ships separate 10 kbps / 200 kbps builds), so AT BR returns ERROR. All other AT commands the script uses (AP, CE, BD, ID, NI) are portable across families.

Changes:

  • sparrow/xbee_configure.py: new --family {868,900} CLI arg. When family=900, the BR command is skipped with an INFO log; everything else runs identically.
  • setup script/sparrow_setup.sh: new prompt_xbee_family() called before run_xbee_configure_if_needed() (only when ROBIN is in use). Uses _yesno (zenity or terminal). Honors an XBEE_FAMILY=868|900 env var for headless / re-runs. Threads --family "\${XBEE_FAMILY:-868}" into the python invocation.
  • Default remains 868 — existing SPARROW builds see zero behavioral change.

Test plan

  • bash -n setup\ script/sparrow_setup.sh — passes.
  • python -m py_compile sparrow/xbee_configure.py — passes.
  • End-to-end validated --family 900 on real hardware: an XBee-PRO 900HP (S3B, HV=234B, VR=8075) attached to a Windows laptop via COM4. Full write completed cleanly (`Skipping BR: RF rate is fixed by firmware on XBee-PRO 900 family.`), then re-opened at 115200 baud and verified AP=1 CE=0 BD=7 ID=1234 NI=SPARROW_MASTER all persisted through the flash write.
  • Confirmed --family 868 (the default) still sends AT BR=1 — the historical code path is untouched.
  • Reviewer sanity check on the prompt_xbee_family() env override and the _yesno fallback ordering.
  • Fresh install on the field Pi with the failing XBee-PRO 900 chip: sudo ./sparrow_setup.sh should now prompt for family, accept "900", complete without the ATBR1 error.

Two independent field-reported failures in sparrow_setup.sh:

1. install_uuidgen() ran `apt install uuid-runtime` unconditionally and
   died with a cryptic 'no installation candidate' error on one Trixie
   Pi whose sources.list was misconfigured (missing 'main' component or
   wrong suite). Guarded the install with an if-branch, added a targeted
   diagnostic that points the operator at the exact sources.list entry
   they need. Also verified against a healthy Trixie install (192.168.1.233)
   that uuid-runtime is still the canonical package on Trixie — util-linux
   does NOT ship uuidgen, contra a common misconception.

2. xbee_configure.py hardcoded `AT BR=1` (RF data rate), which is only a
   valid command on XBee SX 868. On XBee-PRO 900 / 900HP the RF rate is
   fixed by the firmware image loaded on the module (Digi ships separate
   10kbps / 200kbps builds), so the module returns ERROR and the setup
   dies mid-config. Added a --family {868,900} flag to xbee_configure.py
   that skips the BR command on 900-family modules. Added a matching
   XBEE_FAMILY prompt in sparrow_setup.sh (zenity + terminal fallback +
   env override for headless runs). Default stays 868, so existing 868
   builds see zero behavioral change.

Fix 2 empirically validated end-to-end on an XBee-PRO 900HP (S3B, HV=234B,
VR=8075) connected to my Windows laptop: --family 900 completed cleanly
(BR skipped, all other AT commands applied), post-write verify at 115200
baud confirmed AP=1 CE=0 BD=7 ID=1234 NI=SPARROW_MASTER all persisted.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses two field-reported setup/configuration failures by improving uuidgen installation diagnostics on Debian (incl. Trixie) and adding explicit support for XBee-PRO 900/900HP modules by skipping the unsupported AT BR command.

Changes:

  • Harden install_uuidgen() in sparrow_setup.sh to avoid cryptic aborts and provide targeted APT sources diagnostics.
  • Add XBEE_FAMILY prompt/env override in the setup script and thread it into the XBee configuration step.
  • Extend xbee_configure.py with --family {868,900} and skip the BR command for the 900 family.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
sparrow/xbee_configure.py Adds XBee family selection and conditional BR handling for 900/900HP modules.
setup script/sparrow_setup.sh Improves uuidgen install robustness/diagnostics and prompts for XBee family before running configuration.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread sparrow/xbee_configure.py
Comment thread setup script/sparrow_setup.sh
Comment thread setup script/sparrow_setup.sh
@urucoder
Federico Alves (urucoder) merged commit b2dfabf into main Aug 7, 2026
4 checks passed
@Clamps251
Carl Chalmers (Clamps251) deleted the fix-install-uuidgen-trixie branch August 8, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants