[lxc-devel] [PATCH] ubuntu: Actually attempt to remove /dev/shm

Stéphane Graber stgraber at ubuntu.com
Sat Nov 30 00:22:53 UTC 2013


Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
 templates/lxc-ubuntu-cloud.in | 3 ++-
 templates/lxc-ubuntu.in       | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/templates/lxc-ubuntu-cloud.in b/templates/lxc-ubuntu-cloud.in
index 3042d89..e97c7e3 100644
--- a/templates/lxc-ubuntu-cloud.in
+++ b/templates/lxc-ubuntu-cloud.in
@@ -139,8 +139,9 @@ EOF
     # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
     # get bind mounted to the host's /run/shm.  So try to rmdir
     # it, and in case that fails move it out of the way.
+    # NOTE: This can only be removed once 12.04 goes out of support
     if [ ! -L $rootfs/dev/shm ] && [ -d $rootfs/run/shm ] && [ -e $rootfs/dev/shm ]; then
-        mv $rootfs/dev/shm $rootfs/dev/shm.bak
+        rmdir $rootfs/dev/shm 2>/dev/null || mv $rootfs/dev/shm $rootfs/dev/shm.bak
         ln -s /run/shm $rootfs/dev/shm
     fi
 
diff --git a/templates/lxc-ubuntu.in b/templates/lxc-ubuntu.in
index 4e6a54f..8ed9be7 100644
--- a/templates/lxc-ubuntu.in
+++ b/templates/lxc-ubuntu.in
@@ -541,8 +541,9 @@ EOF
     # I'm afraid of doing rm -rf $rootfs/dev/shm, in case it did
     # get bind mounted to the host's /run/shm.  So try to rmdir
     # it, and in case that fails move it out of the way.
+    # NOTE: This can only be removed once 12.04 goes out of support
     if [ ! -L $rootfs/dev/shm ] && [ -d $rootfs/run/shm ] && [ -e $rootfs/dev/shm ]; then
-        mv $rootfs/dev/shm $rootfs/dev/shm.bak
+        rmdir $rootfs/dev/shm 2>/dev/null || mv $rootfs/dev/shm $rootfs/dev/shm.bak
         ln -s /run/shm $rootfs/dev/shm
     fi
 
-- 
1.8.4.4





More information about the lxc-devel mailing list