[meta-virtualization] [PATCH] lxc: warning fixes in busybox template

Bogdan Purcareata bogdan.purcareata at nxp.com
Fri Mar 25 01:12:53 PDT 2016


Warnings fixes:
- optional mounts when dirs not available
- busybox dynamically linked
- fstab not available in container

Please apply on master and jethro branches.

Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>
---
 ...-Remove-warning-for-dynamically-linked-Bu.patch | 43 +++++++++++++++++++
 ...x-Touch-etc-fstab-in-the-container-rootfs.patch | 30 +++++++++++++
 ...t_symlink-Don-t-SYSERROR-on-something-els.patch | 49 ++++++++++++++++++++++
 recipes-containers/lxc/lxc_1.1.4.bb                |  3 ++
 4 files changed, 125 insertions(+)
 create mode 100644 recipes-containers/lxc/files/lxc-busybox-Remove-warning-for-dynamically-linked-Bu.patch
 create mode 100644 recipes-containers/lxc/files/lxc-busybox-Touch-etc-fstab-in-the-container-rootfs.patch
 create mode 100644 recipes-containers/lxc/files/open_without_symlink-Don-t-SYSERROR-on-something-els.patch

diff --git a/recipes-containers/lxc/files/lxc-busybox-Remove-warning-for-dynamically-linked-Bu.patch b/recipes-containers/lxc/files/lxc-busybox-Remove-warning-for-dynamically-linked-Bu.patch
new file mode 100644
index 0000000..c0a810b
--- /dev/null
+++ b/recipes-containers/lxc/files/lxc-busybox-Remove-warning-for-dynamically-linked-Bu.patch
@@ -0,0 +1,43 @@
+From 07e4c41f2963d73b9aedd552c74f17a33e89f020 Mon Sep 17 00:00:00 2001
+From: Bogdan Purcareata <bogdan.purcareata at nxp.com>
+Date: Thu, 24 Mar 2016 11:54:27 +0000
+Subject: [PATCH] lxc-busybox: Remove warning for dynamically linked Busybox
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The warning has been present since commit 32b37181ea (with no purpose stated).
+Support for dynamically linked Busybox has been added since commit bf6cc73696.
+Haven't encountered any issues with dynamically linked Busybox in my last
+2 years' testing.
+
+Upstream-status: Accepted
+[https://github.com/lxc/lxc/commit/07e4c41f2963d73b9aedd552c74f17a33e89f020]
+
+Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>
+Acked-by: Stéphane Graber <stgraber at ubuntu.com>
+---
+ templates/lxc-busybox.in | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
+index f547f9e..336fa12 100644
+--- a/templates/lxc-busybox.in
++++ b/templates/lxc-busybox.in
+@@ -304,13 +304,6 @@ configure_busybox()
+         return 1
+     fi
+ 
+-    file -L $(which busybox) | grep -q "statically linked"
+-    if [ $? -ne 0 ]; then
+-        echo "warning : busybox is not statically linked."
+-        echo "warning : The template script may not correctly"
+-        echo "warning : setup the container environment."
+-    fi
+-
+     # copy busybox in the rootfs
+     cp $(which busybox) $rootfs/bin
+     if [ $? -ne 0 ]; then
+-- 
+1.9.1
+
diff --git a/recipes-containers/lxc/files/lxc-busybox-Touch-etc-fstab-in-the-container-rootfs.patch b/recipes-containers/lxc/files/lxc-busybox-Touch-etc-fstab-in-the-container-rootfs.patch
new file mode 100644
index 0000000..33862dd
--- /dev/null
+++ b/recipes-containers/lxc/files/lxc-busybox-Touch-etc-fstab-in-the-container-rootfs.patch
@@ -0,0 +1,30 @@
+From 6ab1ca0375feeb00070f0c0f9186551b08b1ee5e Mon Sep 17 00:00:00 2001
+From: Bogdan Purcareata <bogdan.purcareata at nxp.com>
+Date: Tue, 22 Mar 2016 13:33:57 +0000
+Subject: [PATCH] lxc-busybox: Touch /etc/fstab in the container rootfs
+
+Upstream-status: Accepted
+[https://github.com/lxc/lxc/commit/6ab1ca0375feeb00070f0c0f9186551b08b1ee5e]
+
+Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>
+---
+ templates/lxc-busybox.in | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/templates/lxc-busybox.in b/templates/lxc-busybox.in
+index c020e66..f547f9e 100644
+--- a/templates/lxc-busybox.in
++++ b/templates/lxc-busybox.in
+@@ -330,6 +330,9 @@ configure_busybox()
+     # relink /sbin/init
+     ln $rootfs/bin/busybox $rootfs/sbin/init
+ 
++    # /etc/fstab must exist for "mount -a"
++    touch $rootfs/etc/fstab
++
+     # passwd exec must be setuid
+     chmod +s $rootfs/bin/passwd
+     touch $rootfs/etc/shadow
+-- 
+1.9.1
+
diff --git a/recipes-containers/lxc/files/open_without_symlink-Don-t-SYSERROR-on-something-els.patch b/recipes-containers/lxc/files/open_without_symlink-Don-t-SYSERROR-on-something-els.patch
new file mode 100644
index 0000000..098ead7
--- /dev/null
+++ b/recipes-containers/lxc/files/open_without_symlink-Don-t-SYSERROR-on-something-els.patch
@@ -0,0 +1,49 @@
+From 88e078ba865b675f9a0dc61caa0732d7052593f8 Mon Sep 17 00:00:00 2001
+From: Christian Brauner <christian.brauner at mailbox.org>
+Date: Wed, 23 Mar 2016 16:37:09 +0100
+Subject: [PATCH] open_without_symlink: Don't SYSERROR on something else than
+ ELOOP
+
+The open_without_symlink routine has been specifically created to prevent
+mounts with synlinks as source or destination. Keep SYSERROR'ing in that
+particular scenario, but leave error handling to calling functions for the
+other ones - e.g. optional bind mount when the source dir doesn't exist
+throws a nasty error.
+
+Upstream-status: Accepted
+[https://github.com/lxc/lxc/commit/88e078ba865b675f9a0dc61caa0732d7052593f8]
+
+Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>
+---
+ src/lxc/utils.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/lxc/utils.c b/src/lxc/utils.c
+index 6bee698..8e7ebbc 100644
+--- a/src/lxc/utils.c
++++ b/src/lxc/utils.c
+@@ -1621,8 +1621,6 @@ static int open_without_symlink(const char *target, const char *prefix_skip)
+ 			errno = saved_errno;
+ 			if (errno == ELOOP)
+ 				SYSERROR("%s in %s was a symbolic link!", nextpath, target);
+-			else
+-				SYSERROR("Error examining %s in %s", nextpath, target);
+ 			goto out;
+ 		}
+ 	}
+@@ -1667,8 +1665,11 @@ int safe_mount(const char *src, const char *dest, const char *fstype,
+ 
+ 	destfd = open_without_symlink(dest, rootfs);
+ 	if (destfd < 0) {
+-		if (srcfd != -1)
++		if (srcfd != -1) {
++			saved_errno = errno;
+ 			close(srcfd);
++			errno = saved_errno;
++		}
+ 		return destfd;
+ 	}
+ 
+-- 
+1.9.1
+
diff --git a/recipes-containers/lxc/lxc_1.1.4.bb b/recipes-containers/lxc/lxc_1.1.4.bb
index e017dcf..2645f4b 100644
--- a/recipes-containers/lxc/lxc_1.1.4.bb
+++ b/recipes-containers/lxc/lxc_1.1.4.bb
@@ -37,6 +37,9 @@ SRC_URI = "http://linuxcontainers.org/downloads/${BPN}-${PV}.tar.gz \
 	file://open_without_symlink-Account-when-prefix-is-empty-st.patch \
 	file://lxc_setup_fs-Create-dev-shm-folder-if-it-doesn-t-exi.patch \
 	file://mount_proc_if_needed-only-safe-mount-when-rootfs-is-.patch \
+	file://open_without_symlink-Don-t-SYSERROR-on-something-els.patch \
+	file://lxc-busybox-Touch-etc-fstab-in-the-container-rootfs.patch \
+	file://lxc-busybox-Remove-warning-for-dynamically-linked-Bu.patch \
 	"
 
 SRC_URI[md5sum] = "d33c4bd9c57755c0e2b0e2acbc3f171d"
-- 
1.9.1



More information about the meta-virtualization mailing list