packages/os/usb-installer/README.md
Electrobun-targeted microapp for preparing bootable elizaOS USB installers.
This package has two modes:
ELIZAOS_USB_ENABLE_RAW_WRITE=1.The renderer never opens raw disks. It talks to the local backend contract; disk enumeration, privileged writes, and platform subprocesses stay server-side.
UsbInstallerBackend.planId.127.0.0.1 and only allows localhost browser
origins from the known app/dev ports or ELIZAOS_USB_ALLOWED_ORIGINS.ELIZAOS_USB_ENABLE_RAW_WRITE=1 is required for non-dry-run planning and
execution./execute accepts only a server-generated planId; renderer-supplied disk
paths, image URLs, or full write plans are ignored.ELIZAOS_USB_PLAN_TTL_MS) and must be regenerated before execution.safe-removable drives, undersized drives, and placeholder checksums.bun run --cwd packages/os/usb-installer dev
bun run --cwd packages/os/usb-installer build
bun run --cwd packages/os/usb-installer test
bun run --cwd packages/os/usb-installer typecheck
bun run --cwd packages/os/usb-installer lint
bun run --cwd packages/os/usb-installer test:e2e
Run the guarded Linux virtual block-device write proof:
bun run --cwd packages/os/usb-installer test:linux-virtual-usb
That test requires Linux, passwordless sudo -n, and the kernel
scsi_debug module. It creates a disposable 64 MiB removable block device with
model ELIZAUSBTEST, writes a trusted 4 MiB image through the same local
server/Linux backend flow, reads the first 4 MiB back, verifies SHA-256, and
unloads the module. It refuses to run if scsi_debug is already loaded.
CI runs this proof only on Linux runners that provide the scsi_debug module.
Run the local app:
bun run --cwd packages/os/usb-installer start
Enable live writes only when deliberately testing removable media:
ELIZAOS_USB_ENABLE_RAW_WRITE=1 bun run --cwd packages/os/usb-installer start
src/backend/types.ts is the load-bearing boundary between the renderer and
privileged platform operations:
listRemovableDrives() returns drive candidates with safe-removable,
blocked-system, or unknown safety classifications.listImages() returns trusted elizaOS image metadata after manifest
validation. Invalid URLs, checksums, unsupported channels/architectures,
missing build metadata, and impossible minimum USB sizes are rejected.createWritePlan() returns the resolve, checksum, write, verify, and complete
steps. HTTP-backed plans include a server-generated planId.executeWritePlan() is destructive. The HTTP backend sends only planId;
direct platform backends require callers to pass a plan that satisfies the
shared write-safety.ts guards.macOS:
diskutil list -plist and diskutil info -plist./dev/rdiskN and rejects partition paths.osascript ... with administrator privileges for the current prototype
write path. A signed helper is still the preferred production boundary.Linux:
lsblk --json --bytes.pkexec, cached/allowed sudo, kdesu, or doas plus dd.Windows:
Get-Disk/Get-Partition.diskpart and dd.exe or a native PowerShell streaming
fallback. A signed elevated helper is still required before calling Windows
production-grade.This package is code-ready only after tests/build pass. It is USB-proven only after a final ISO is written to a real removable drive and boot-tested.
The Linux virtual block-device E2E is stronger than a unit test because it uses
real lsblk, sudo, dd, sync, and a kernel block device. It still is not a
substitute for physical USB flash and boot validation.
Remaining production hardening:
sync/eject/status completion.