[PATCH] init.c, halt command not working

Denys Vlasenko vda.linux at googlemail.com
Mon Mar 31 12:52:14 PDT 2008


On Monday 31 March 2008 21:59, Harald Küthe wrote:
> > The sequence of events is:
> > SIGUSR1 is received
> > halt_reboot_pwoff(SIGUSR1) calls
> >  kill_all_processes() calls
> >   run_actions(SHUTDOWN):
> >                         if (a->action_type & (SYSINIT | WAIT | 
> CTRLALTDEL | SHUTDOWN | RESTART)) {
> >                                 waitfor(run(a));
> >                                 delete_init_action(a);
> > run(a) vforks... and this is somehow doesn't work very well
> 
> It looks as if SIGUSR1 is !!not!! received because halt_reboot_pwoff()
> is not processed.

Please confirm that you added a debug printout to
halt_reboot_pwoff and it is not triggering when halt
sends SIGUSR1 to init.

In this case, can you do this change int init.c:

static pid_t run(const struct init_action *a)
{
...
        if (pid)
+{
+                bb_signals(0
+                        + (1 << SIGUSR1)  /* halt */
+                        + (1 << SIGUSR2)  /* poweroff */
+                        + (1 << SIGTERM)  /* reboot */
+                        , halt_reboot_pwoff);
                return pid;
+}

Basically, it restores SIGUSR1 handling in the parent
after child sets it to SIG_DFL.

Does this fix things?
--
vda


More information about the busybox mailing list