qemu: boot the UI through the panel shipped init chain (flare-edge#2210) #32

Merged
noah merged 1 commits from rb/ln-init-chain into rebuild 2026-10-28 11:32:37 -06:00
Owner

Boot the rig's UI through the panel's shipped init chain (flare-edge #2210 part 2, rig half). Branch rb/ln-init-chain (a4bbfbd, from rebuild 7d5686e).

Why

Stage-2 init starts /usr/bin/warden-ui directly as root. It never runs S03warden-accounts, S99lvgl or warden-ui-run, so no privilege drop, respawn loop or safe mode is exercised. That is how flare-edge #1903 (BusyBox setpriv has no --reuid) left every rebuild image from 2026-10-14 without a panel UI while CI stayed green.

What

  • mkimage.sh: ROOTFS_OVERLAY=<dir> lays a directory of panel files over the rootfs of both slots, modes kept. Only etc/ and usr/ may appear at its top, and no entry may be a symlink, so it cannot replace the rig's /init or /sbin/init. A refused overlay fails closed and writes no image.
  • rootfs/sbin/init: with warden.initchain on the command line (run.sh --append warden.initchain) it runs /etc/init.d/S00-S09 with start before the bus, and S10-S99 after the payload daemons in place of the direct UI start (warden_init_chain in warden-lib.sh). Rig differences: the splash handover is marked done (no S09splash), and warden-ui-run gets -b fbdev instead of the panel's -b drm. A chain boot with no script prints WARDEN-QEMU-INITCHAIN-EMPTY and starts no UI, so a check that asked for the chain cannot pass on the direct start.
  • warden_rig_bus_owners: when S03warden-accounts has created the accounts, cred/ui belongs to warden-ui and the cred directory to group warden-bus, as S10bus does on a panel. Without those accounts (every boot today) it changes nothing.
  • README section and two scenario rows.

Without warden.initchain and ROOTFS_OVERLAY nothing changes for existing boots.

Tests

New, both added to ci.yml:

  • qemu/tests/init-chain-test.sh: 19 checks, also under busybox sh. Covers the order and number range, the non-executable and directory entries that are skipped, a failing script that is named while the chain goes on, the count, the credential owners, and the init wiring (S00-S09 before the bus, S10-S99 after the daemons and before the direct start, the direct start skipped).
  • qemu/tests/rootfs-overlay.sh: 17 scenarios, with real images read back by debugfs. The overlay lands in both slots with its modes and beside the skeleton's files. Without an overlay there is no /etc/init.d. Six refused overlays: not a directory, sbin/, init, an inner symlink, a top-level symlink, and a dot file.

Run on bfe-mpc-0056 (lane-remote LN):

init-chain: 19 checks / init-chain: all checks passed   (sh and busybox sh)
rootfs-overlay: all scenarios passed
PASS: rig bus; PASS: rig init starts the daemons in the panel's S-number order; payload-dir: all scenarios passed
mutant caught guard / exec / range / order / owners / failname   (6 of 6)

Locally: shellcheck -x over qemu/.sh, qemu/tests/.sh, warden-lib.sh, sbin/init, init, rc is clean, and ALL QEMU-INIT SHELLCHECK TESTS PASSED.

0056 has no qemu-system-arm, so no VM was booted here. The boot itself is checked by the flare-edge half (a QEMU gate step that stages S03warden-accounts, S99lvgl, warden-ui-run and uid-check.sh, boots with warden.initchain, and asserts at T+120 s that warden-ui runs as its account with one loop and no safe mode).

Refs flare-edge#2210

Generated with Claude Code
https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG

Boot the rig's UI through the panel's shipped init chain (flare-edge #2210 part 2, rig half). Branch rb/ln-init-chain (a4bbfbd, from rebuild 7d5686e). ## Why Stage-2 init starts `/usr/bin/warden-ui` directly as root. It never runs S03warden-accounts, S99lvgl or warden-ui-run, so no privilege drop, respawn loop or safe mode is exercised. That is how flare-edge #1903 (BusyBox setpriv has no `--reuid`) left every rebuild image from 2026-10-14 without a panel UI while CI stayed green. ## What - `mkimage.sh`: `ROOTFS_OVERLAY=<dir>` lays a directory of panel files over the rootfs of both slots, modes kept. Only `etc/` and `usr/` may appear at its top, and no entry may be a symlink, so it cannot replace the rig's `/init` or `/sbin/init`. A refused overlay fails closed and writes no image. - `rootfs/sbin/init`: with `warden.initchain` on the command line (`run.sh --append warden.initchain`) it runs `/etc/init.d/S00`-`S09` with `start` before the bus, and `S10`-`S99` after the payload daemons in place of the direct UI start (`warden_init_chain` in warden-lib.sh). Rig differences: the splash handover is marked done (no S09splash), and warden-ui-run gets `-b fbdev` instead of the panel's `-b drm`. A chain boot with no script prints `WARDEN-QEMU-INITCHAIN-EMPTY` and starts no UI, so a check that asked for the chain cannot pass on the direct start. - `warden_rig_bus_owners`: when S03warden-accounts has created the accounts, `cred/ui` belongs to `warden-ui` and the cred directory to group `warden-bus`, as S10bus does on a panel. Without those accounts (every boot today) it changes nothing. - README section and two scenario rows. Without `warden.initchain` and `ROOTFS_OVERLAY` nothing changes for existing boots. ## Tests New, both added to ci.yml: - `qemu/tests/init-chain-test.sh`: 19 checks, also under `busybox sh`. Covers the order and number range, the non-executable and directory entries that are skipped, a failing script that is named while the chain goes on, the count, the credential owners, and the init wiring (S00-S09 before the bus, S10-S99 after the daemons and before the direct start, the direct start skipped). - `qemu/tests/rootfs-overlay.sh`: 17 scenarios, with real images read back by debugfs. The overlay lands in both slots with its modes and beside the skeleton's files. Without an overlay there is no `/etc/init.d`. Six refused overlays: not a directory, `sbin/`, `init`, an inner symlink, a top-level symlink, and a dot file. Run on bfe-mpc-0056 (lane-remote LN): ``` init-chain: 19 checks / init-chain: all checks passed (sh and busybox sh) rootfs-overlay: all scenarios passed PASS: rig bus; PASS: rig init starts the daemons in the panel's S-number order; payload-dir: all scenarios passed mutant caught guard / exec / range / order / owners / failname (6 of 6) ``` Locally: `shellcheck -x` over qemu/*.sh, qemu/tests/*.sh, warden-lib.sh, sbin/init, init, rc is clean, and ALL QEMU-INIT SHELLCHECK TESTS PASSED. 0056 has no qemu-system-arm, so no VM was booted here. The boot itself is checked by the flare-edge half (a QEMU gate step that stages S03warden-accounts, S99lvgl, warden-ui-run and uid-check.sh, boots with `warden.initchain`, and asserts at T+120 s that warden-ui runs as its account with one loop and no safe mode). Refs flare-edge#2210 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah added 1 commit 2026-10-28 10:36:02 -06:00
qemu: boot the UI through the panel's shipped init chain (flare-edge#2210)
ci / prune-artifacts (push) Skipped
ci / patches-apply (push) Successful in 24s
ci / bench (pull_request) Successful in 16s
ci / test (push) Successful in 24s
ci / mcdc (push) Successful in 29s
ci / kernel-build (push) Skipped
ci / test (pull_request) Successful in 10s
ci / quality (push) Successful in 39s
ci / badges (push) Skipped
ci / mcdc (pull_request) Successful in 30s
ci / bench (push) Successful in 10s
ci / qemu-tools (push) Successful in 3m16s
ci / qemu-tools (pull_request) Successful in 2m34s
ci / kernel-symbols (pull_request) Successful in 1m54s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / patches-apply (pull_request) Successful in 55s
ci / quality (pull_request) Successful in 1m36s
ci / badges (pull_request) Skipped
ci / kernel-symbols (push) Successful in 4m24s
a4bbfbd83b
The rig's stage-2 init starts /usr/bin/warden-ui directly as root, so it
never ran S03warden-accounts, S99lvgl or warden-ui-run: no privilege drop,
respawn loop or safe mode was exercised, and the BusyBox setpriv bug of
flare-edge #1903 left every rebuild image without a UI while CI was green.

- mkimage.sh: ROOTFS_OVERLAY lays a directory of panel files over the
  rootfs of both slots, modes kept. Only etc/ and usr/ at its top, no
  symlinks; a refused overlay writes no image.
- sbin/init: with warden.initchain on the command line it runs
  /etc/init.d/S00-S09 before the bus and S10-S99 after the payload daemons,
  in place of the direct UI start (warden_init_chain in warden-lib.sh). The
  splash handover is marked done and warden-ui-run gets "-b fbdev". A chain
  boot without scripts prints WARDEN-QEMU-INITCHAIN-EMPTY and starts no UI.
- warden_rig_bus_owners: when the accounts exist, cred/ui belongs to
  warden-ui and the cred directory to group warden-bus, as S10bus does.
- Tests: init-chain-test.sh (19 checks, also under busybox sh) and
  rootfs-overlay.sh (17 scenarios, images read back with debugfs), both in CI.

Refs flare-edge#2210

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KerYPVh72hhNgKi3wS5ijG
noah merged commit f46a3519aa into rebuild 2026-10-28 11:32:37 -06:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: blueflare/bfe-core1106-sdk#32