[Lxc-users] How to make a container init DIE after finishing runlevel 0
Daniel Lezcano
daniel.lezcano at free.fr
Mon Jan 25 23:55:39 UTC 2010
Michael H. Warfield wrote:
> On Mon, 2010-01-25 at 23:39 +0100, Daniel Lezcano wrote:
>
>> Michael H. Warfield wrote:
>>
>>> On Mon, 2010-01-25 at 21:50 +0100, Daniel Lezcano wrote:
>>>
>>>
>>>
>>>>> apologies for the length, but how is everyone else handling this?
>>>>> this is the last thing i need to solve before i actually start running
>>>>> all my services on this setup.
>>>>>
>>>>>
>>>>>
>>>> I was wondering if the kernel shouldn't send a signal to the init's
>>>> parent when sys_reboot is called.
>>>>
>>>>
>>> Which still leaves open the question of telling the difference between a
>>> halt and a reboot.
>>>
>> Well, with the correct information in siginfo, that should do the trick:
>>
>
>
>> si_num = SIGINFO ? SIGHUP ?
>> si_code = SI_KERNEL
>> si_int = the "cmd" passed to the reboot (2) function.
>>
>
> I concur that sounds like a good option. But that's a kernel mod and
> will require a kernel patch and getting that through the process. Once
> that's agreed on that's the route to go, we've got to get the containers
> guys involved and get that pushed through. And is this going to work
> without any modifications to init itself (per the discussion over on the
> -devel list wrt modifications to init and the difficulty and pain of
> pulling teeth). What's the next step?
>
Send a patch with this hack even if it is not the right approach, let's
receive some flaming and discuss with containers@/lkml@ about this problem.
As I have, one foot in userspace with lxc and another foot in the
container kernel development, if we reach a consensus, that should not
be a big deal to push upstream a patch, especially if this is a blocker
for the container technology.
The objective is to have a kernel patch making possible to support the
"shutdown / halt / reboot / etc ... " without modifying the init command
and compatible with sysv init and upstart. The patch I propose is to
send a signal to the parent process of the pid namespace, in our case
it's lxc-start. Handling this signal is quite easy as we have just "kill
-9" the init process and, in case of a reboot, return to the starting
code without exiting lxc-start.
More information about the lxc-users
mailing list