[lxc-devel] [PATCH] lxc-busybox: check when bind-mounting host libdirs

Bogdan Purcareata bogdan.purcareata at freescale.com
Tue May 14 09:04:44 UTC 2013


The patch changes the busybox template behavior to automatically
mount /lib and /usr/lib. In case one of these folders does not exist,
starting the container will fail. Also, if there are other lib entries
on the host - e.g. /usr/lib64 -  mount them as well.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata at freescale.com>
---
 templates/lxc-busybox.in | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
index cb425ec..49effae 100644
--- a/templates/lxc-busybox.in
+++ b/templates/lxc-busybox.in
@@ -240,13 +240,6 @@ lxc.pts = 1
 #lxc.aa_profile = unconfined
 EOF
 
-if [ -d "$rootfs/lib" ]; then
-cat <<EOF >> $path/config
-lxc.mount.entry = /lib $rootfs/lib none ro,bind 0 0
-lxc.mount.entry = /usr/lib $rootfs/usr/lib none ro,bind 0 0
-EOF
-fi
-
     libdirs="\
         lib \
         usr/lib \
@@ -255,6 +248,7 @@ fi
 
     for dir in $libdirs; do
         if [ -d "/$dir" ] && [ -d "$rootfs/$dir" ]; then
+            echo "lxc.mount.entry = /$dir $rootfs/$dir none ro,bind 0 0" >> $path/config
             echo "lxc.mount.entry = /$dir $dir none ro,bind 0 0" >> $path/config
         fi
     done
-- 
1.7.11.7






More information about the lxc-devel mailing list