How to enable Linux namespace in system based on kernel 2.6.38 and initd?

2.1k views Asked by At

I want to run LXC 2.0 on linux kernel 2.6.38 and init.d, whether both kernel version and initd are mandatory.

I have recompiled the Kernel with namespace support as follow.

# Kernel parameters
CONFIG_NAMESPACES=y
CONFIG_CGROUP_NS=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y


[root@ts ~]# CONFIG=$(pwd)/.config lxc-checkconfig
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
newuidmap is not installed
newgidmap is not installed
Network namespace: enabled
Multiple /dev/pts instances: enabled
--- Control groups ---
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: missing
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled 

Everything runs successful until I hit the following issue on lxc-start -n ts1 --logfile=ts1.log.

lxc_start - start.c:preserve_ns:138 - No such file or directory - Kernel does not support attaching to namespaces.

LXC/start.c:138 says that my parent process does not have /proc/<PID>/ns folder and when I check it was true even for all processes in the system including initd.

I assume that initd does not take namespaces into account as initial process.

What I need to do in order to get initd attached with namespace?

1

There are 1 answers

0
frater_sourcecode On

edit: misread question ,correcting:

it seems having - https://cateee.net/lkddb/web-lkddb/PID_NS.html is not enough, there is probably another option required. (CONFIG_EXPERIMENTAL?)

I do remember seeing a howto Debian Squeeze (6 , 2.6 kernel line) with lxc containers somewhere, so it should be doable, maybe try and grab Kconfig from there and compare .

I also found this patch-set, try and compare maybe: http://lxc.sourceforge.net/patches/linux/2.6.38/2.6.38.2-lxc1/patches/

Also, consider old lxc (v1) , I wouldn't expect compatibility with kernels from ~2009 would be high (if at all) priority - so chances are there will be many more caveats and traps with lxd with such ancient kernel .