[Lxc-users] Container shutdown remounts the lxc partition read-only... again

Serge Hallyn serge.hallyn at ubuntu.com
Thu Jun 27 14:02:31 UTC 2013


Quoting Leonid Isaev (lisaev at umail.iu.edu):
> On Fri, 21 Jun 2013 09:27:44 -0500
> Serge Hallyn <serge.hallyn at ubuntu.com> wrote:
> 
> > Quoting Leonid Isaev (lisaev at umail.iu.edu):
> > > Hi,
> > > 
> > > 	I have recently installed vanilla lxc-0.9.0 under archlinux and
> > > encountered the old "fs is remounted ro" issue which is supposed to be
> > > fixed since https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/942325 ...
> > > The (also archlinux) containers' rootfs are located on a separate
> > > partition mounted at /var/lib/lxc
> > > ----------
> > > $ mount | grep lxc
> > > /dev/sda3 on /var/lib/lxc type ext4(rw,nosuid,nodev,relatime,data=ordered)
> > > ----------
> > > The rootfs.hold file is open, according to strace run against lxc-start,
> > > e.g.: ----------
> > > $ grep hold /var/log/lxc.strace.log
> > > open("/var/lib/lxc/arch-LXC-test/rootfs.hold", O_RDWR|O_CREAT, 0600) = 13
> > > ----------
> > > 
> > > Nevertheless, whenever I shutdown the container via lxc-stop,
> > > the /var/lib/lxc partition is marked ro... What can I do to determine
> > > what's going wrong?
> > 
> > what fs type are you using for /var/lib/lxc?
> 
> Just an ext4.

I just tried on ubuntu precise (3.2.0-48-generic) with daily ppa lxc
(0.9.0.0~staging~20130619-1813-0ubuntu1~ppa1~precise1), created a new
ext4 lv, mounted it at /var/lib/lxc2, and created a container there.
Started it, logged in and powered off; started it, lxc-stop'ped it.
Switched its profile to unconfined, started and stopped it.  But the
fs stayed mounted rw.

> > I'd try: create a loopback fs with that fstype, mount it under /mnt2,
> > then run:
> > 
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <fcntl.h>
> > 
> > cat > holdopen.c << EOF
> > int main(int argc, char *argv[]) {
> > 	FILE *f = fopen(argv[1], "w");
> > 	fprintf(f, "1022\n");
> > 	fflush(f);
> > 	lockf(fileno(f), F_TLOCK, 0);
> > 	sleep(999);
> > }
> > EOF
> > 
> > make holdopen
> > ./holdopen /mnt2/xxx
> > mount -o remount,ro /mnt2/xxx
> > 
> > and see if it succeeds.
> 
> Mount correctly fails saying the FS is busy... After looking at lxc source, I
> am very confused because pin_rootfs() in src/conf.c seems to do almost same
> thing. I've rebuilt lxc-0.9.0 locally instead of using the packaged one, but
> still shutting down the container gives a read-only FS. Can it be related to
> the fact that both host and guest run systemd?

No, I don't think so.  I can't think of anything the init would be
doing to make this happen.

Kernel seems more likely.

> Also, please note that
> lxc-shutdown has no effect as systemd powers off on receiving SIGRTMIN+4 (this
> is configured via lxc.stopsignal by the lxc-archlinux template, so lxc-stop
> gracefully shuts down the container).

-serge




More information about the lxc-users mailing list