All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lxc-busybox: check when bind-mounting host libdirs
@ 2013-05-14  9:41 Bogdan Purcareata
  2013-05-14 13:25 ` Bruce Ashfield
  0 siblings, 1 reply; 2+ messages in thread
From: Bogdan Purcareata @ 2013-05-14  9:41 UTC (permalink / raw)
  To: meta-virtualization

The patch checks bind mounting lib directories when starting a
busybox container on a 64bit platform. Some entries in the host
filesystem are not present but the busybox template expects them
to be there, and thus container start fails.

Please see further details in added patch description.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
---
 ...xc-0.9.0-check-when-bind-mounting-libdirs.patch | 44 ++++++++++++++++++++++
 recipes-containers/lxc/lxc_0.9.0.bb                |  1 +
 2 files changed, 45 insertions(+)
 create mode 100644 recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch

diff --git a/recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch b/recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch
new file mode 100644
index 0000000..4d21a02
--- /dev/null
+++ b/recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch
@@ -0,0 +1,44 @@
+From 9e74f8161b8db05365fde0646b0c29c852afc3a0 Mon Sep 17 00:00:00 2001
+From: Bogdan Purcareata <bogdan.purcareata@freescale.com>
+Date: Tue, 14 May 2013 11:54:23 +0300
+Subject: [PATCH] lxc-busybox: check when bind-mounting host libdirs
+
+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@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
+
diff --git a/recipes-containers/lxc/lxc_0.9.0.bb b/recipes-containers/lxc/lxc_0.9.0.bb
index 63ce2d6..1cbbad0 100644
--- a/recipes-containers/lxc/lxc_0.9.0.bb
+++ b/recipes-containers/lxc/lxc_0.9.0.bb
@@ -24,6 +24,7 @@ RDEPENDS_${PN} = " \
 SRC_URI = "http://lxc.sourceforge.net/download/lxc/${PN}-${PV}.tar.gz \
 	file://lxc-0.9.0-disable-udhcp-from-busybox-template.patch \
 	file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch \
+    file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \
 	"
 SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9"
 SRC_URI[sha256sum] = "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120"
-- 
1.7.11.7




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lxc-busybox: check when bind-mounting host libdirs
  2013-05-14  9:41 [PATCH] lxc-busybox: check when bind-mounting host libdirs Bogdan Purcareata
@ 2013-05-14 13:25 ` Bruce Ashfield
  0 siblings, 0 replies; 2+ messages in thread
From: Bruce Ashfield @ 2013-05-14 13:25 UTC (permalink / raw)
  To: Bogdan Purcareata; +Cc: meta-virtualization

FYI: your local gitconfig is picking up your login ID as the sender, I changed
the reply manually.

On Tue, May 14, 2013 at 5:41 AM, Bogdan Purcareata
<bogdan.purcareata@freescale.com> wrote:
> The patch checks bind mounting lib directories when starting a
> busybox container on a 64bit platform. Some entries in the host
> filesystem are not present but the busybox template expects them
> to be there, and thus container start fails.

Looks sensible/reasonable to me. I haven't run into this myself, probably just
by luck!

I'll wait a bit for more comments, but will push the change after that.

Bruce

>
> Please see further details in added patch description.
>
> Signed-off-by: Bogdan Purcareata <bogdan.purcareata@freescale.com>
> ---
>  ...xc-0.9.0-check-when-bind-mounting-libdirs.patch | 44 ++++++++++++++++++++++
>  recipes-containers/lxc/lxc_0.9.0.bb                |  1 +
>  2 files changed, 45 insertions(+)
>  create mode 100644 recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch
>
> diff --git a/recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch b/recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch
> new file mode 100644
> index 0000000..4d21a02
> --- /dev/null
> +++ b/recipes-containers/lxc/files/lxc-0.9.0-check-when-bind-mounting-libdirs.patch
> @@ -0,0 +1,44 @@
> +From 9e74f8161b8db05365fde0646b0c29c852afc3a0 Mon Sep 17 00:00:00 2001
> +From: Bogdan Purcareata <bogdan.purcareata@freescale.com>
> +Date: Tue, 14 May 2013 11:54:23 +0300
> +Subject: [PATCH] lxc-busybox: check when bind-mounting host libdirs
> +
> +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@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
> +
> diff --git a/recipes-containers/lxc/lxc_0.9.0.bb b/recipes-containers/lxc/lxc_0.9.0.bb
> index 63ce2d6..1cbbad0 100644
> --- a/recipes-containers/lxc/lxc_0.9.0.bb
> +++ b/recipes-containers/lxc/lxc_0.9.0.bb
> @@ -24,6 +24,7 @@ RDEPENDS_${PN} = " \
>  SRC_URI = "http://lxc.sourceforge.net/download/lxc/${PN}-${PV}.tar.gz \
>         file://lxc-0.9.0-disable-udhcp-from-busybox-template.patch \
>         file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch \
> +    file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \
>         "
>  SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9"
>  SRC_URI[sha256sum] = "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120"
> --
> 1.7.11.7
>
>
> _______________________________________________
> meta-virtualization mailing list
> meta-virtualization@yoctoproject.org
> https://lists.yoctoproject.org/listinfo/meta-virtualization



--
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-05-14 13:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-14  9:41 [PATCH] lxc-busybox: check when bind-mounting host libdirs Bogdan Purcareata
2013-05-14 13:25 ` Bruce Ashfield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.