[lxc-devel] startup scripts for lxc containers?

Dietmar Maurer dietmar at proxmox.com
Fri Jan 15 17:40:02 UTC 2010


> > You can execute command inside the container. So you just
> > need to exec halt/shutdown inside the container?
> >
> The problem we are facing is to detect when a process did a sys_reboot
> in order to kill the init process.
> Otherwise the container is shutdown but the pid 1 still lives and the
> container never exits.

Oh, I thought init calls exit after it killed all children.
 
> 
> If I am not wrong the shutdown command sends a command to the init
> process to switch to run level 0 making the different services to do
> the
> right things. When this level is reached the shutdown process calls
> sys_reboot(SHUTDOWN) (which actually fails in a container because the
> CAP_SYS_REBOOT is dropped).

well, i will test that (and take a look at the init/upstart code).

> A work around would be to add in the latest shutdown script a write,
> for
> example to a fifo, which is read from the parent's init process in
> order
> to detect a shutdown. But we can not do the difference between a reboot
> or a shutdown, that looks like a trick more than a real solution...
> 
> For this reason, I proposed to hack the sys_reboot syscall and do
> "something", I don't know what exactly (maybe sending a signal to the
> init's parent with the relevant information).

OK

- Dietmar
 






More information about the lxc-devel mailing list