[BusyBox] Reboot not working?

Adam Slattery aslattery at sunriselinux.com
Sun Nov 11 13:44:32 UTC 2001


> On Thu Nov 08, 2001 at 03:11:05PM -0500, Adam Slattery wrote:
> > > The reboot/halt applets in busybox normally rely on the init applet being
> > > turned on, as they just send a signal to it to trigger the reboot/halt.
> > > I'm attaching the patch I use against 0.60.1 to make reboot/halt call the
> > > syscall directly if the init applet is turned off.
> > 
> > Actually, this is the proper way :). reboot/halt/poweroff should always
> > call the syscall, not init. When init calls it, the kernel thinks init is
> > exiting and thus generates a kernel panic.
> 
> Actually, that is not the proper way at all.  :)  sysvinit calls
> the reboot syscall itself.  The sysvinit reboot command just
> sends a message to the init process (via a named pipe) and the init
> process then proceeds to shut things down.  This allows the init
> process to inform all the apps that they should perform a
> gracefull shutdown and gives them a few seconds to cleanup.
> 
>  -Erik

No, sysvinit does not make the syscall itself. Look at the source code to 
halt.c and init.c (from sysvinit).

A sysvinit halt/poweroff goes like this: init changes to runlevel 0 and
runs the appropriate script(s).  The last command executed is 'halt -f' or
'poweroff -f', which is what executes the syscall.  When 'halt -f' is run,
it stops init (SIGTSTP), then makes a syscall to actually halt the system.
The same goes for poweroff and reboot (which are links to halt), but they
use differant flags to the reboot syscall.

In terms of shutdowns, the named pipe is only used to change runlevels. 
The only time init makes a reboot syscall is to enable ctrl-alt-del.

- Adam Slattery






More information about the busybox mailing list