[vserver] Getting a real pid 1 init in a container

From: Grzegorz Nosek <grzegorz.nosek_at_gmail.com>
Date: Mon 19 Mar 2012 - 18:08:54 GMT
Message-ID: <4F677636.80909@gmail.com>

Hi,

Continuing my quest to run Ubuntu 12.04 under Linux-VServer (so far only
on kernels I have on hand, probably considered ancient around these parts).

Can anybody please explain to me what is the semantics of the fakeinit
vserver flag? I changed /sbin/init to the following script to see what's
going on:

#!/bin/sh

echo $$
exec /sbin/init.real

With initstyle=plain and various combinations of fakeinit and PID
namespaces I'm getting:

fakeinit, no pidns:

pid is 1 and upstart (init.real) apparently starts successfully but does
not receive SIGCHLD when a process inside the container dies, thus
breaking start/stop/restart tools (and waitpid(-1) returns -ESRCH). I
did not instrument the real init to see if the SIGCHLD goes there instead.

!fakeinit, no pidns:

init starts with a high pid (like it was run on the host) and becomes
telinit, so the container does not start at all. The page at
http://linux-vserver.org/Upstart_issues#Notes_for_older_kernels suggests
this is an issue for 2.6.22 but I'm testing this on 2.6.27 and 2.6.35.
Also, I'm not sure how exactly is the result of getpid() cached over
exec() but I'll just accept it at face value.

!fakeinit, with pidns:

init starts with pid 2, fails to work just like above due to pid != 1

fakeinit, with pidns:

exactly as above, pid 2, doesn't work either

Having a quick look at the kernel and util-vserver code, I see some
correlation between vx_set_reaper(), which I apparently want to call,
and the fakeinit flag, looking like it wants to prevent it. Will give it
a closer look tomorrow, but in the meantime, any comments about the
fakeinit flag (and its relation to setting the reaper process) are
greatly appreciated.

Best regards,
  Grzegorz Nosek
Received on Mon Mar 19 18:09:06 2012

[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 19 Mar 2012 - 18:09:06 GMT by hypermail 2.1.8