[Pkg-sysvinit-devel] Bug#652168: don't run "swapoff -a" for lxc

Harald Dunkel harald.dunkel at aixigo.de
Thu Dec 15 14:00:46 UTC 2011


On 12/15/11 12:23, Roger Leigh wrote:
> On Thu, Dec 15, 2011 at 11:50:40AM +0100, Harald Dunkel wrote:
>> PS: A similar problem exists for /etc/init.d/umountroot.
>> It remounts the lxc root partition read-only, which affects
>> the host system. This is a severe problem.
>>
>> The workaround is to disable both startup scripts in
>> /etc/insserv/overrides.
> 
> Does "ischroot" correctly detect an lxc container?  i.e.
> 
> ischroot; echo $?
> 

No, it doesn't:

	root at vs001:~# ischroot
	root at vs001:~# echo $?
	1

(This is Squeeze. ischroot is not available in Squeeze,
but it built fine.)

AFAIK /proc/1/cgroup shows in lxc

	root at vs001:~# cat /proc/1/cgroup
	1:blkio,net_cls,freezer,devices,cpuacct,cpu,ns,cpuset:/vs001

"vs001" is the container name. On the host system I see

	srvl028:/var/lib/lxc# cat /proc/1/cgroup
	1:blkio,net_cls,freezer,devices,cpuacct,cpu,ns,cpuset:/

instead. But I doubt that this is a stable method to detect lxc.


Regards

Harri





More information about the Pkg-sysvinit-devel mailing list