fix(live-seed): _seed_find_partition's gpart fallback was dead code #289
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/seed-find-partition-gpart-fallback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two bugs, found live on an HP ML350p Gen8 booted from USB (22.jul.26)
while debugging why the same box's own CLAWDIESEED went undetected
every boot despite genuinely being present and mountable:
The awk fallback searched
gpart show -lpoutput for a fieldmatching "^/dev/" — that output never contains a "/dev/" prefix in
its device-name column (confirmed directly: a real row reads
"diskid/DISK-...p4 CLAWDIESEED (64M)", never "/dev/diskid/...").
The condition could never match, on any system, so this fallback
has never actually worked for anyone.
glabel(4) does not reliably publish per-partition GPT labels for
every disk. On the box this was found on, a separate raidz1 pool's
member disks got gpt/gptboot0, gpt/swap0, etc. published, but the
seed's own disk published only a whole-disk diskid/... tag — none
of its own partition labels, including CLAWDIESEED, even though
gpart show -lpread the label correctly straight from the GPTmetadata. So the primary /dev/gpt/ lookup can silently miss
a partition that is present, correctly labeled, and mountable.
Fix: parse the partition-device and label columns directly from
gpart show -lp(reliably the third-from-last and second-from-lastfields on a matching data row) and build the /dev path ourselves,
instead of depending on glabel having published one.
Added tests/seed-find-partition-test.sh (fakes gpart, no real disks
needed) covering both the successful-match and no-match cases.