A bootable hardware audit, and the rule that the station's own hardware is not the machine's
A bootable USB tool that reads a second-hand machine's hardware directly into an extensible profile instead of a fixed set of columns — and the defect that had it record its own boot stick's model and size as the machine's storage, which became a rule applied again in OS detection, the wipe engine and the storage scan.
What was done
Built a bootable USB tool that boots a second-hand machine into Linux, reads its processor, memory, storage, screen and battery directly, and posts the result to the API as an extensible profile rather than a fixed set of columns — every later station feature (drive health, lock detection, OS capture, hardware tests) was added inside that structure without a schema change. Three decisions were settled here: the tool collects into a lot and does no verification, audit.conf is git-ignored because it carries credentials, and the operator never has to type (autorun plus a desktop launcher). The defect worth recording is that the tool enumerated block devices and took the first one as the machine's drive — which was the USB stick it had booted from, so every audit recorded the stick's model and size as the machine's storage. The fix generalised into a rule reused across the station: the station's own hardware is not the machine's.
lsblk -d: every disk the station can see
sda usb RM=1 <- the boot stick
nvme0n1 nvme RM=0
sdb usb RM=1 <- operator's spare
before: take the first one
storage = "SanDisk Ultra, 32GB"
after: TYPE=disk, TRAN!=usb, RM!=1,
/sys/block/<d>/removable != 1
storage = "nvme0n1, 512GB"
rule: the station's own hardware is not the
machine'sWhat the station sees, and what it is allowed to call the machine's storage.
Status
Shipped, 13–14 July 2026.
The problem
A second-hand PC arrives with no reliable documentation of what is inside it. Somebody has to open it, or boot it, and write down the processor, memory, storage, screen and battery. Done by hand this is slow, inconsistent between technicians, and frequently wrong — a laptop's installed RAM is not what a sticker says, and a screen size guessed by eye is a guess.
What was built
A bootable USB tool that boots the machine into Linux, reads its hardware directly, and posts a profile to the API.
A comprehensive, extensible hardware profile rather than a fixed set of columns — because the thing worth recording about a machine grows, and every later feature in this project (drive health, lock detection, OS capture, hardware tests) was added inside that structure without a schema change.
Display on the asset page plus serial and express-service-code search, and full hardware spec in the lot Excel report.
Three decisions that held
collect INTO a lot, no verification. The first version tried to verify the machine against something. It was reworked so the tool simply captures into a lot: the audit states what is there, and reconciliation is a separate concern. Mixing them made both worse.
audit.conf is git-ignored. The tool's configuration carries
Wi-Fi credentials and server credentials. It has never been in the repository,
and later work added a rule that its values are never read or printed — only
presence and format.
** — run without typing.** Autorun and a desktop launcher, because the operator is holding a screwdriver. Every later iteration of the station pushed harder in this direction, ending in a kiosk that boots straight into the interface.
The defect worth recording
the PC was mis-identified as its own USB boot stick.
The tool enumerated block devices and took the first one as the machine's drive. The first device was the stick it had booted from. Every audit recorded the USB stick's model and size as the machine's storage.
This is the ancestor of a rule that appears throughout the station: the station's own hardware is not the machine's. It recurs in the OS detection (never report the station's Ubuntu as the machine's operating system), in the wipe engine (never wipe the boot drive, whatever it reports itself as), and in the storage scan (removable and USB devices are skipped).
What was deliberately not built
No attempt to identify anything the machine does not report. A screen size that cannot be read is left blank rather than inferred from the chassis.
Open questions
SystemRescue was the base at this point. It was replaced by Ubuntu
in September when Secure Boot became a requirement — see
2026-09-02-device-locks-and-ubuntu-base.md.
The code
The storage scan after the fix: parse lsblk without eval, then drop anything that is not an internal fixed disk.
# Pull KEY="value" from an lsblk -P line WITHOUT eval. eval would define shell
# vars literally named MODEL/SERIAL and clobber the machine's identity read
# above (lsblk's column names collide with ours) — that mis-identified the PC
# as its USB boot stick. Distinct D_* names keep the two completely separate.
pval() { printf ' %s' "$1" | grep -oE " $2=\"[^\"]*\"" | head -n1 | sed -e "s/^ $2=\"//" -e 's/"$//'; }
while IFS= read -r line; do
D_NAME=$(pval "$line" NAME); D_TYPE=$(pval "$line" TYPE)
D_TRAN=$(pval "$line" TRAN); D_RM=$(pval "$line" RM)
[ "$D_TYPE" = "disk" ] || continue
# Exclude USB sticks, external HDD/SSD, SD cards and the live boot medium.
[ "$D_TRAN" = "usb" ] && continue
[ "$D_RM" = "1" ] && continue
[ "$(cat "/sys/block/$D_NAME/removable" 2>/dev/null)" = "1" ] && continue
# ... one storage element per surviving drive
donetools/hardware-audit.sh — an excerpt, trimmed to the technique it illustrates.
Not shown. The wipe engine's boot-drive refusal ladder (als_boot_disk and the gui_wipe_one refusal cases) is the same rule applied to a destructive operation, and is a safety control still in use, so none of its internals are shown — only the read-only inventory filter. Also withheld: the contents and field names of audit.conf, and the API endpoint the profile is posted to.
A published copy. Commit references and internal identifiers have been removed and the operator is not named; the engineering, the counts and the stated limits are unchanged.