The QEMU rig's stage-2 init (qemu/rootfs/sbin/init) is a busybox sh script running as PID 1. Busybox reboot, poweroff and halt work by signalling PID 1 (SIGTERM, SIGUSR2, SIGUSR1), and the kernel drops any signal PID 1 has no handler for. So on the rig a plain reboot does nothing, while a panel's busybox init honours it.
Found writing blueflare/flare-edge#96's flow: Settings > System > Reboot calls warden_reboot(), which runs system("reboot") and falls back to reboot -f only if that fails. Sending the signal succeeds, so on the rig nothing happens and the flow's expect_reboot times out ("no reboot within 60s"; the console shows no restart line). flared's BOOTSLOT path passed on the same rig only because it always follows up with reboot -f.
Also: the init idles in while :; do sleep 3600; done, so even a trap would run only after the current sleep returns.
Fix
Trap TERM/USR2/USR1 in the init and perform the matching -f action after a sync, and idle with sleep & wait so the trap runs at once. Regression test: a qemu test that runs a plain reboot in the guest and expects the orderly restart.
The QEMU rig's stage-2 init (`qemu/rootfs/sbin/init`) is a busybox `sh` script running as PID 1. Busybox `reboot`, `poweroff` and `halt` work by signalling PID 1 (SIGTERM, SIGUSR2, SIGUSR1), and the kernel drops any signal PID 1 has no handler for. So on the rig a plain `reboot` does nothing, while a panel's busybox init honours it.
Found writing blueflare/flare-edge#96's flow: Settings > System > Reboot calls `warden_reboot()`, which runs `system("reboot")` and falls back to `reboot -f` only if that fails. Sending the signal succeeds, so on the rig nothing happens and the flow's `expect_reboot` times out ("no reboot within 60s"; the console shows no restart line). flared's BOOTSLOT path passed on the same rig only because it always follows up with `reboot -f`.
Also: the init idles in `while :; do sleep 3600; done`, so even a trap would run only after the current sleep returns.
## Fix
Trap TERM/USR2/USR1 in the init and perform the matching `-f` action after a sync, and idle with `sleep & wait` so the trap runs at once. Regression test: a qemu test that runs a plain `reboot` in the guest and expects the orderly restart.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The QEMU rig's stage-2 init (
qemu/rootfs/sbin/init) is a busyboxshscript running as PID 1. Busyboxreboot,poweroffandhaltwork by signalling PID 1 (SIGTERM, SIGUSR2, SIGUSR1), and the kernel drops any signal PID 1 has no handler for. So on the rig a plainrebootdoes nothing, while a panel's busybox init honours it.Found writing blueflare/flare-edge#96's flow: Settings > System > Reboot calls
warden_reboot(), which runssystem("reboot")and falls back toreboot -fonly if that fails. Sending the signal succeeds, so on the rig nothing happens and the flow'sexpect_reboottimes out ("no reboot within 60s"; the console shows no restart line). flared's BOOTSLOT path passed on the same rig only because it always follows up withreboot -f.Also: the init idles in
while :; do sleep 3600; done, so even a trap would run only after the current sleep returns.Fix
Trap TERM/USR2/USR1 in the init and perform the matching
-faction after a sync, and idle withsleep & waitso the trap runs at once. Regression test: a qemu test that runs a plainrebootin the guest and expects the orderly restart.