From f40960a3a3bb4a1a9433fe61a873b7ffc5e57db9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Mon, 6 Apr 2015 12:11:25 -0400 Subject: [PATCH] Fix incomplete destruction of unprivileged ephemeral containers MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If an unprivileged ephemeral container is started as follows, lxc-start-ephemeral -o trusty -n test_ephemeral Then an empty directory remains upon exit from the container, ~/.local/share/lxc/test_ephemeral/tmpfs/delta0 (The tmpfs filesystem is successfully unmounted, but we seem to lack permission to delete the delta0 directory). This issue arose following commits 4799a1e and dd2271e . The following patch resolves the issue. It has been tested on ubuntu 14.04 with the lxc-daily ppa. Since gmail screws up the formatting of the patch via line-wrapping etc, please copy the patch from the issue-tracker rather than from this email. Signed-off by: Oleg Freedholm Acked-by: Stéphane Graber --- src/lxc/lxc-start-ephemeral.in | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lxc/lxc-start-ephemeral.in b/src/lxc/lxc-start-ephemeral.in index b049f80ac..7bf336e92 100644 --- a/src/lxc/lxc-start-ephemeral.in +++ b/src/lxc/lxc-start-ephemeral.in @@ -240,17 +240,15 @@ LXC_NAME="%s" count = 0 for entry in overlay_dirs: tmpdir = "%s/tmpfs" % dest_path + fd.write("mkdir -p %s\n" % (tmpdir)) + if args.storage_type == "tmpfs": + fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (tmpdir)) deltdir = "%s/delta%s" % (tmpdir, count) workdir = "%s/work%s" % (tmpdir, count) fd.write("mkdir -p %s %s\n" % (deltdir, entry[1])) if have_new_overlay: fd.write("mkdir -p %s\n" % workdir) - if args.storage_type == "tmpfs": - fd.write("mount -n -t tmpfs -o mode=0755 none %s\n" % (tmpdir)) - fd.write("mkdir %s\n" % deltdir) - fd.write("mkdir %s\n" % workdir) - fd.write("getfacl -a %s | setfacl --set-file=- %s || true\n" % (entry[0], deltdir)) fd.write("getfacl -a %s | setfacl --set-file=- %s || true\n" % -- 2.47.2