qemu: rig init honours reboot, poweroff and halt #6

Merged
noah merged 1 commits from qemu-init-reboot into flare-edge-next 2026-09-28 13:07:22 -06:00
Owner

Fixes #5.

The rig PID 1 is a busybox sh script; busybox reboot/poweroff/halt only signal PID 1, and the kernel drops signals PID 1 does not handle, so a plain reboot did nothing on the rig (found by flare-edge#96: Settings > System > Reboot).

  • warden_trap_power_signals (etc/warden-lib.sh): TERM/USR2/USR1 perform the -f action after a sync.
  • warden_idle_forever: sleep & wait, so the trap runs at once.
  • qemu/tests/init-power-signals-test.sh in CI: runs the real helpers with stub commands and sends each signal.
Check Result
init-power-signals-test.sh 3/3 PASS
Mutation: TERM trap removed FAIL caught
Mutation: foreground sleep 3 FAIL caught, no hang
shellcheck clean

Generated with Claude Code

https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg

Fixes #5. The rig PID 1 is a busybox sh script; busybox reboot/poweroff/halt only signal PID 1, and the kernel drops signals PID 1 does not handle, so a plain `reboot` did nothing on the rig (found by flare-edge#96: Settings > System > Reboot). - `warden_trap_power_signals` (etc/warden-lib.sh): TERM/USR2/USR1 perform the `-f` action after a sync. - `warden_idle_forever`: `sleep & wait`, so the trap runs at once. - `qemu/tests/init-power-signals-test.sh` in CI: runs the real helpers with stub commands and sends each signal. | Check | Result | |---|---| | init-power-signals-test.sh | 3/3 PASS | | Mutation: TERM trap removed | FAIL caught | | Mutation: foreground sleep | 3 FAIL caught, no hang | | shellcheck | clean | Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg
noah added 1 commit 2026-09-28 11:17:23 -06:00
qemu: rig init honours reboot, poweroff and halt
ci / test (push) Successful in 13s
ci / bench (push) Successful in 5s
ci / mcdc (push) Successful in 15s
ci / patches-apply (push) Successful in 22s
ci / qemu-tools (push) Successful in 46s
ci / qemu-tools (pull_request) Successful in 42s
ci / prune-artifacts (pull_request) Skipped
ci / kernel-build (pull_request) Skipped
ci / prune-artifacts (push) Skipped
ci / kernel-build (push) Skipped
ci / quality (push) Successful in 37s
ci / badges (push) Skipped
ci / test (pull_request) Successful in 13s
ci / mcdc (pull_request) Successful in 11s
ci / bench (pull_request) Successful in 5s
ci / patches-apply (pull_request) Successful in 16s
ci / quality (pull_request) Successful in 27s
ci / badges (pull_request) Skipped
07db1b9ec0
The stage-2 init is a busybox sh script running as PID 1. Busybox reboot,
poweroff and halt only signal PID 1 (TERM, USR2, USR1), and the kernel
drops a signal PID 1 has no handler for, so a plain reboot did nothing on
the rig while a panel's busybox init honours it. Settings > System >
Reboot hit exactly that (flare-edge#96).

warden_trap_power_signals performs the -f action after a sync, and
warden_idle_forever idles with sleep & wait so the trap runs at once
instead of after an hour-long foreground sleep.

Test: qemu/tests/init-power-signals-test.sh runs the real helpers in sh
with stub commands and sends each signal; it fails without the traps and
with a foreground sleep, and cannot hang on failure.

Fixes #5

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01441BzdGcvQmXkiN2qDjfZg
noah merged commit 317ae087fd into flare-edge-next 2026-09-28 13:07:22 -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#6