[lxc-devel] A question about lxc

Gui Jianfeng guijianfeng at cn.fujitsu.com
Thu Jul 2 09:51:33 UTC 2009


Daniel Lezcano wrote:
> Gui Jianfeng wrote:
>> Daniel Lezcano wrote:
>>  
>>> Gui Jianfeng wrote:
>>>    
>>>> Hi Daniel,
>>>>
>>>> I tried lxc and have A question about lxc
>>>>
>>>> I successfully built lxc in my box, and i played with
>>>> it as following.
>>>>
>>>> #lxc-create -n foo
>>>> #lxc-execute -n foo /bin/bash
>>>> #lxc-ps -n foo
>>>>
>>>> Then, I got the following error:
>>>>
>>>> cat: /usr/local/var/lib/lxc/foo/nsgroup/tasks: No such file or
>>>> directory
>>>> ERROR: List of process IDs must follow -p.
>>>>
>>>> I checked the code, IMHO, "/usr/local/var/lib/lxc/foo/nsgroup" should
>>>> link
>>>> to the corresponding Cgroup directory. But i can't find out which part
>>>> of the code takes care of creating Cgroup directory.
>>>>
>>>> Would you explain this a bit?
>>>>         
>>> Hi Gui,
>>>
>>> lxc does not create the cgroup directory, it is automatically created
>>> when a namespace is created, this is a feature of the ns_cgroup. It is
>>> probable you mounted the cgroup without the "ns" option or the feature
>>> is not enabled in the kernel.
>>>
>>> There is a tool to check the kernel configuration : lxc-checkconfig; it
>>> should give you some informations about the kernel config.
>>> You should see something like that:
>>>
>>> --- Namespaces ---
>>> Namespaces: enabled
>>> Utsname namespace: enabled
>>> Ipc namespace: enabled
>>> Pid namespace: enabled
>>> User namespace: enabled
>>> Network namespace: enabled
>>> Multiple /dev/pts instances: enabled
>>>
>>> --- Control groups ---
>>> Cgroup: enabled
>>> Cgroup namespace: enabled
>>> Cgroup device: enabled
>>> Cgroup sched: enabled
>>> Cgroup cpu account: enabled
>>> Cgroup memory controller: enabled
>>> Cgroup cpuset: disabled
>>>
>>> --- Misc ---
>>> Veth pair device: enabled
>>> Macvlan: enabled
>>>     
>>
>> Hi Daniel,
>>
>> I tried lxc-checkconfig and got the following output with the config
>> on 2.6.30.
>> It seems "ns_cgroup" is already enabled.
>>
>> Kernel config /proc/config.gz not found, looking in other places...
>> Found kernel config file /lib/modules/2.6.30/build/.config
>> --- Namespaces ---
>> Namespaces: enabled
>> Utsname namespace: enabled
>> Ipc namespace: enabled
>> Pid namespace: enabled
>> User namespace: enabled
>> Network namespace: enabled
>> Multiple /dev/pts instances: disabled
>>
>> --- Control groups ---
>> Cgroup: enabled
>> Cgroup namespace: enabled
>> Cgroup device: enabled
>> Cgroup sched: disabled
>> Cgroup cpu account: enabled
>> Cgroup memory controller: enabled
>> Cgroup cpuset: enabled
>>
>> --- Misc ---
>> Veth pair device: disabled
>> Macvlan: disabled
>>   
> 
> Can you check in /proc/mount, you have the cgroup mounted with the ns
> option
> 
> Mine is:
> 
> /cgroup /cgroup cgroup
> rw,relatime,net_cls,freezer,devices,memory,cpuacct,cpu,ns,debug 0 0
> 
> I mounted the cgroup with the option:
> 
> mount -t cgroup cgroup /cgroup

  Thanks, It's working when ns_cgroup is mounted.

> 
> 
> 
> 
> 
> 

-- 
Regards
Gui Jianfeng





More information about the lxc-devel mailing list