From bffe56510c83ac4c23b30455cf2811e5d6ae99b1 Mon Sep 17 00:00:00 2001 From: Bogdan Purcareata Date: Fri, 25 Mar 2016 08:12:53 +0000 Subject: lxc: warning fixes in busybox template Warnings fixes: - optional mounts when dirs not available - busybox dynamically linked - fstab not available in container Signed-off-by: Bogdan Purcareata Signed-off-by: Bruce Ashfield --- ...-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 ++++++++++++++++++++++ 3 files changed, 122 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 (limited to 'recipes-containers/lxc/files') 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 00000000..c0a810b1 --- /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 +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 +Acked-by: Stéphane Graber +--- + 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 00000000..33862ddc --- /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 +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 +--- + 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 00000000..098ead7e --- /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 +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 +--- + 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 + -- cgit v1.2.3-54-g00ecf