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

From: Daniel Hokka Zakrisson <>
Date: Mon 19 Mar 2012 - 20:03:09 GMT
Message-ID: <58391.>

Grzegorz Nosek wrote:
> 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).

Versions are always relevant...

> 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:

I'd go further and also make it start a daemon and attempt to wait for

> #!/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.

... since unless your kernel is broken, I don't think that is happening.
But, the kernel debugging should tell you exactly.

> !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
> 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.

No, you're telling it not to get pid 1, so it doesn't.

> !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

Pid namespaces are not implemented yet.

> 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.

No, there is no relation. fakeinit sets pid 1, --initpid to vcontext
sets the reaper.

Daniel Hokka Zakrisson
Received on Mon Mar 19 20:03:23 2012
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 19 Mar 2012 - 20:03:23 GMT by hypermail 2.1.8