reboot
Denis Vlasenko
vda at ilport.com.ua
Mon Oct 17 05:20:04 UTC 2005
On Sunday 16 October 2005 19:46, Rob Landley wrote:
> On Sunday 16 October 2005 08:41, Denis Vlasenko wrote:
> > On Sunday 16 October 2005 15:35, walter harms wrote:
> > > hi Rob,
> > > i tried the busybox reboot command with my embedded board works fine.
> > > but when i try to kill init (with kill) to cause a reboot ... no success.
> > > i suspect that killing init may not cause a reboot under all
> > > circumstances.
> >
> > I always wondered why signaling init was chosen as a way to initiate
> > reboot.
>
> So that init can run the shutdown script?
Shutdown script started by something else than init works
as good as one started by init. At least on my system.
> > After all, we do not mount devices by signaling init.
>
> No, init gets execed as the first process in the system and thus runs the init
> script. There's nothing running _to_signal init, it's the first process.
>
> > We do not up network interfaces by signaling init.
>
> The ones brought up by the init script are kicked off by init.
I meant "we do not do <some admin actions> by 'kill -<somesig> 1', why do we do
this particular admin action (reboot) in this bizarre way?".
> > We can kill all processes, remount ro and reboot without signaling init.
>
> And on a system where init is set to respawn daemons, every time you kill one
> init will start it up again, and you'll be involved in an endless game of
> whack-a-mole. (Or you'll shutdown with daemons starting up, doing who knows
> what to the filesystem state...)
This is because inits which respawn daemons are a bad idea. They are trying
to perform two unrelated things at once: (1) to wait for orphaned processes,
and (2) to respawn processes. It's old System V way of doing thing, and it is
_wrong_.
If you start a separate "daemon spawner" process at system start
and thus will split this functionality between two processes, init's code
gets much simpler:
1) init does not need to respawn anything.
2) init does not need to know how to shutdown/reboot.
In fact, both reboot and init can be implemented with shell scripts
(and they are on my system).
--
vda
More information about the busybox
mailing list