Isn't this a known and fixed issue? Well, fixed enough for now anyway.
Daniel made a patch and I incorporated it into an opensuse build service package that is just stock 0.6.5 with only that patch and my startup/shutdown scripts, and have been using that package a lot ever since with no problems.

The patch is attached.
The openSUSE package incorporating it is here:
http://download.opensuse.org/repositories/home:/aljex/openSUSE_11.2/x86_64/lxc-0.6.5-46.1.x86_64.rpm

--
bkw



On 4/13/2010 11:29 PM, Serge E. Hallyn wrote:
Pier, the url you quote talks about only the second container
failing.  Is that your experience as well?

Matt, yours fails on the very first container, right?

Matt, can you confirm that downgrading to 0.6.3 (which does not
use pivot_root iirc) works for you?  I'll try to take a look on
my own karmic server kvm instance this week.

thanks,
-serge

Quoting Pier Fumagalli ([email protected]):
It seems to me this is pretty much what I'm seeing too with 0.6.5.

http://www.mail-archive.com/[email protected]/msg00029.html

In my case, I downgraded to 0.6.3 and it works just fine.

     Pier


On Wed, Apr 14, 2010 at 05:33, Matt Bailey<[email protected]>  wrote:

With lxc 0.6.5, I am having a problem starting a container.  Here is
the debug output. (FWIW, my /var is a separate partition on the host)

# lxc-start -n test -l DEBUG -o $(tty)
      lxc-start 1271189821.303 INFO     lxc_conf - tty's configured
      lxc-start 1271189821.303 DEBUG    lxc_start - sigchild handler set
      lxc-start 1271189821.303 INFO     lxc_start - 'test' is initialized
      lxc-start 1271189821.313 DEBUG    lxc_conf - instanciated veth
'veth5RnMGB/veth28579F', index is '14'
      lxc-start 1271189821.394 DEBUG    lxc_cgroup - using cgroup
mounted at '/cgroup'
      lxc-start 1271189821.395 DEBUG    lxc_cgroup - '/cgroup/2229'
renamed to '/cgroup/test'
      lxc-start 1271189821.554 DEBUG    lxc_conf - move 'br0' to '2229'
      lxc-start 1271189821.554 INFO     lxc_conf - 'test' hostname has
been setup
      lxc-start 1271189821.571 DEBUG    lxc_conf - 'eth0' has been setup
      lxc-start 1271189821.571 INFO     lxc_conf - network has been setup
      lxc-start 1271189821.571 DEBUG    lxc_cgroup - using cgroup
mounted at '/cgroup'
      lxc-start 1271189821.571 DEBUG    lxc_conf - cgroup
'devices.deny' set to 'a'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 1:3 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 1:5 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 5:1 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 5:0 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 4:0 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 4:1 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 1:9 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 1:8 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 136:* rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 5:2 rwm'
      lxc-start 1271189821.572 DEBUG    lxc_conf - cgroup
'devices.allow' set to 'c 254:0 rwm'
      lxc-start 1271189821.572 INFO     lxc_conf - cgroup has been setup
      lxc-start 1271189821.572 INFO     lxc_conf - mount points have been
setup
      lxc-start 1271189821.572 INFO     lxc_conf - console
'/dev/pts/0' mounted to '/var/lib/urizen-slicer/fs/test/dev/console'
      lxc-start 1271189821.572 INFO     lxc_conf - 4 tty(s) has been setup
      lxc-start 1271189821.572 DEBUG    lxc_conf - temporary
mountpoint for old rootfs is './lxc-oldrootfs-y10fSV'
      lxc-start 1271189821.572 DEBUG    lxc_conf - pivot_root syscall
to '/lxc-oldrootfs-y10fSV' successful
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/dev/pts'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/dev/shm'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/sys/fs/fuse/connections'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/sys/kernel/debug'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/sys/kernel/security'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/proc'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var/run'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var/lock'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/lib/init/rw'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/cgroup'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var/lib/urizen-slicer/fs/test/dev/console'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var/lib/urizen-slicer/fs/test/dev/tty1'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var/lib/urizen-slicer/fs/test/dev/tty2'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var/lib/urizen-slicer/fs/test/dev/tty3'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var/lib/urizen-slicer/fs/test/dev/tty4'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/dev'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/sys'
      lxc-start 1271189821.573 DEBUG    lxc_conf - umounted
'/lxc-oldrootfs-y10fSV/var'
      lxc-start 1271189821.573 ERROR    lxc_conf - Device or resource
busy - could not unmount old rootfs
lxc-start: Device or resource busy - could not unmount old rootfs
      lxc-start 1271189821.573 ERROR    lxc_conf - failed to
pivot_root to '/var/lib/urizen-slicer/fs/test'
lxc-start: failed to pivot_root to '/var/lib/urizen-slicer/fs/test'
      lxc-start 1271189821.573 ERROR    lxc_conf - failed to set
rootfs for 'test'
lxc-start: failed to set rootfs for 'test'
      lxc-start 1271189821.573 ERROR    lxc_start - failed to setup
the container
lxc-start: failed to setup the container
      lxc-start 1271189821.573 NOTICE   lxc_start - '/sbin/init'
started with pid '2229'
      lxc-start 1271189821.573 DEBUG    lxc_utils - closing fd '1'
      lxc-start 1271189821.573 DEBUG    lxc_utils - closing fd '0'
      lxc-start 1271189821.573 DEBUG    lxc_utils - closed all
inherited file descriptors
      lxc-start 1271189821.634 DEBUG    lxc_start - child exited
      lxc-start 1271189821.634 INFO     lxc_error - child<2229>  ended
on error (255)
      lxc-start 1271189821.634 DEBUG    lxc_cgroup - using cgroup
mounted at '/cgroup'
      lxc-start 1271189821.714 DEBUG    lxc_cgroup - '/cgroup/test' unlinked


Thanks,
--
Matt Bailey


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Lxc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-users


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev

_______________________________________________
Lxc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-users


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Lxc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-users


Re: [Lxc-users] Can't start a 2nd container with 0.6.5
Daniel Lezcano
Sat, 23 Jan 2010 13:44:33 -0800

Brian K. White wrote:
> However, now when I go to make a 2nd container, I can't start it.
> I can create it, but not execute or start.
> [...] 
> Well I'm more boggled now.
> I stopped my first container nj12.
> lxc-ls shows nothing, screen -ls shows nothing, mount shows nothing extra, 
> yet trying to start nj13 still fails, and trying to start nj12 still succeeds.
>
> I can't find anything functionally different between nj12 and nj13...
> What could I be missing???

Yep, there is a problem with the pivot root and the umount of the different 
mount point in the old rootfs. This problem appears with some configuration (I 
didn't figure out which one yet), I did a hot fix, which is more a workaround 
than a real fix, (I didnt't understand where is coming the real problem).

As soon as I find the culprit, I will release a 0.6.6 version to fix that as 
the 0.6.5 is bogus.

In the meantime, if you wish to test, I attached the patch to this email.

Thanks for reporting the problem.

 -- Daniel

---
 src/lxc/conf.c |   41 ++++++++++++++++++++++++++++++-----------
 1 file changed, 30 insertions(+), 11 deletions(-)

Index: lxc/src/lxc/conf.c
===================================================================
--- lxc.orig/src/lxc/conf.c
+++ lxc/src/lxc/conf.c
@@ -67,6 +67,10 @@ lxc_log_define(lxc_conf, lxc);
 #define MS_REC 16384
 #endif
 
+#ifndef MNT_DETACH
+#define MNT_DETACH 2
+#endif
+
 #ifndef CAP_SETFCAP
 #define CAP_SETFCAP 31
 #endif
@@ -532,6 +536,7 @@ static int setup_rootfs_pivot_root(const
 
                lxc_list_for_each(iterator, &mountlist) {
 
+                       /* umount normally */
                        if (!umount(iterator->elem)) {
                                DEBUG("umounted '%s'", (char *)iterator->elem);
                                lxc_list_del(iterator);
@@ -544,24 +549,38 @@ static int setup_rootfs_pivot_root(const
        } while (still_mounted > 0 && still_mounted != last_still_mounted);
 
 
-       lxc_list_for_each(iterator, &mountlist)
+       lxc_list_for_each(iterator, &mountlist) {
+
+               /* let's try a lazy umount */
+               if (!umount2(iterator->elem, MNT_DETACH)) {
+                       INFO("lazy unmount of '%s'", (char *)iterator->elem);
+                       continue;
+               }
+
+               /* be more brutal (nfs) */
+               if (!umount2(iterator->elem, MNT_FORCE)) {
+                       INFO("forced unmount of '%s'", (char *)iterator->elem);
+                       continue;
+               }
+
                WARN("failed to unmount '%s'", (char *)iterator->elem);
+       }
 
-       /* umount old root fs */
-       if (umount(pivotdir)) {
+       /* umount old root fs; if some other mount points are still
+        * there, we won't be able to umount it, so we have to do
+        * that in a lazy way otherwise the container will always
+        * fail to start
+        */
+       if (umount2(pivotdir, MNT_DETACH)) {
                SYSERROR("could not unmount old rootfs");
                return -1;
        }
        DEBUG("umounted '%s'", pivotdir);
 
-       /* remove temporary mount point */
-       if (pivotdir_is_temp) {
-               if (rmdir(pivotdir)) {
-                       SYSERROR("can't remove temporary mountpoint");
-                       return -1;
-               }
-
-       }
+       /* remove temporary mount point, we don't consider the removing
+        * as fatal */
+       if (pivotdir_is_temp && rmdir(pivotdir))
+               WARN("can't remove temporary mountpoint: %m");
 
        INFO("pivoted to '%s'", rootfs);
        return 0;
------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Lxc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-users

Reply via email to