Hi all,

I've been debugging an issue where we can't reboot or poweroff a machine
in the early stages of busybox init. Using the poweroff case as an
example:

 - kernel starts /sbin/init

 - kernel receives a poweroff event, so calls __orderly_poweroff.
   Effectively, these will just call out to the /sbin/poweroff usermode
   helper.

 - /sbin/poweroff just does a:

     kill(1, SIGUSR2);

 - However, /sbin/init has not yet installed a signal handler for
   SIGUSR2. Because we're PID 1, this means the signal is ignored, and
   so the command to poweroff the machine is dropped.

 - init keeps booting rather than powering off.

In our particular case, the "poweroff event" is an IPMI soft shutdown
message. However, the same would apply for any other path that involves
orderly_poweroff or orderly_reboot.

Even though the signal handlers are installed fairly early in init, we
can still hit the race between this and the SIGUSR2 being sent fairly
reliably.

I see a couple of options for resolving this:

 - installing the signal handlers even earlier in init_main(). However,
   this will only reduce the window for lost events, rather than
   eliminating it; or

 - using a synchronous channel to send the shutdown/reboot message
   between the poweroff/reboot helpers, rather than an asynchronous
   signal. Say, have init listening on a socket, allowing the poweroff
   binary to wait and/or retry.

However, before I go down the wrong path here: does anyone have other
ideas that might help eliminating dropped poweroff/reboot events?

Regards,


Jeremy
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to