api_start: don't get a container reference for the daemonized case

In the daemonized case we will fork, so the anonymous container memlock
will not be shared between parent and child.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
lxc-start: store PID file to lxc_container

So we can remove PID file untill lxc_container_free.

This also fix bug: https://github.com/lxc/lxc/issues/89

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
daemon: fix the wrong pid in daemon model

When you start a container in daemon model, you have at least
3 processes:
 1. The command the user start (lxc-start -d)
 2. The backgrounded fork of that command after start() is done
 3. The container init process

In PID file, we need (2), but currently we are writing (1),
this is wrong because (1) exits as soon as the container is
started, it's complately useless.

So we write pid after daemonize, so that we'll always write
the right pid to PID file.

Reported-by: Stephane Graber <stgraber@ubuntu.com>
Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
plamo: Improve template

allow not to specify a variable that is related installed packages

Signed-off-by: TAMUKI Shoichi <tamuki@linet.gr.jp>
Signed-off-by: KATOH Yasufumi <karma@jazz.email.ne.jp>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
cgroupfs: support older kernels without cgroup.clone_children

When creating a cgroup, detect whether cgroup.clone_children
exists.  If not, then manually copy the parent's cpuset.cpus
and cpuset.mems values.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
bionic: Replace rindex by strrchr

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
lxc-clone: support unprivileged use

This also fixes unprivileged use of lxc-snapshot and lxc-rename.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
doc: Try to clear some confusion about lxc.conf

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
lxc-start-ephemeral: require root

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>