Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#652168: don't run "swapoff -a" for lxc

491 views
Skip to first unread message

Harald Dunkel

unread,
Dec 15, 2011, 5:50:01 AM12/15/11
to
Package: initscripts
Version: 2.88dsf-13.1

Problem with /etc/init.d/umountfs: For lxc systems it is not
reasonable to ignore /etc/fstab and to run "swapoff -a"
instead. This gives you an error message

Deactivating swap...swapoff: Not superuser.
failed.
mount: permission denied

even though /etc/fstab is empty.


Surely just a minor problem. Regards

Harri



--
To UNSUBSCRIBE, email to debian-bugs-...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org

Harald Dunkel

unread,
Dec 15, 2011, 6:00:01 AM12/15/11
to
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.

Roger Leigh

unread,
Dec 15, 2011, 6:30:01 AM12/15/11
to
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 $?

It should be nonzero on the host system, zero in the container.

If so, we can just run it in the initscript to conditionally
run swapoff and umountroot.


Regards,
Roger

--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.

Harald Dunkel

unread,
Dec 15, 2011, 9:10:01 AM12/15/11
to
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@vs001:~# ischroot
root@vs001:~# echo $?
1

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

AFAIK /proc/1/cgroup shows in lxc

root@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

Dmitry Bogatov

unread,
Dec 29, 2018, 1:40:03 PM12/29/18
to

control: reassign -1 debianutils

Reassigning bug to owner of /usr/bin/ischroot


[2011-12-15 15:00] Harald Dunkel <harald...@aixigo.de>
>
> part text/plain 965
0 new messages