[pkg-cryptsetup-devel] Bug#783297: [PATCH initramfs-tools 1/2] hooks/busybox: Fail if busybox is wanted but not found

Ben Hutchings ben at decadent.org.uk
Sun Dec 6 19:15:33 UTC 2015


Currently we silently fall back to klibc if BUSYBOX=y but we can't
find it.  This can result in an unusable initramfs, so fail instead
of continuing.

This mitigates bug #783297.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
---
 conf/initramfs.conf |  2 +-
 debian/NEWS         | 10 ++++++++++
 hooks/busybox       |  6 +++++-
 hooks/klibc         |  2 +-
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/conf/initramfs.conf b/conf/initramfs.conf
index 93f88bc..367d561 100644
--- a/conf/initramfs.conf
+++ b/conf/initramfs.conf
@@ -22,7 +22,7 @@ MODULES=most
 #
 # BUSYBOX: [ y | n ]
 #
-# Use busybox if available.
+# Use busybox shell and utilities.  If set to n, klibc utilities will be used.
 #
 
 BUSYBOX=y
diff --git a/debian/NEWS b/debian/NEWS
index a5d68be..021e75c 100644
--- a/debian/NEWS
+++ b/debian/NEWS
@@ -1,3 +1,13 @@
+initramfs-tools (0.121) UNRELEASED; urgency=medium
+
+  * If initramfs-tools is configured to use busybox but it is not
+    installed, mkinitramfs will now fail.  Previously it would quietly use
+    klibc instead, sometimes producing a broken initramfs.  You may need
+    to modify /etc/initramfs-tools/initramfs-tools.conf or install busybox
+    when upgrading.
+
+ -- Ben Hutchings <ben at decadent.org.uk>  Sun, 06 Dec 2015 02:58:35 +0000
+
 initramfs-tools (0.119) unstable; urgency=medium
 
   * The initramfs will now run fsck on the root filesystem before
diff --git a/hooks/busybox b/hooks/busybox
index d6dd3f5..45d4bea 100755
--- a/hooks/busybox
+++ b/hooks/busybox
@@ -16,7 +16,11 @@ prereqs)
 esac
 
 # busybox
-if [ "${BUSYBOX}" != "n" ] && [ -e ${BUSYBOXDIR}/busybox ]; then
+if [ "${BUSYBOX}" != "n" ]; then
+	if ! [ -e ${BUSYBOXDIR}/busybox ]; then
+		echo >&2 "E: busybox is required but not installed"
+		exit 1
+	fi
 	. /usr/share/initramfs-tools/hook-functions
 	rm -f ${DESTDIR}/bin/sh
 	rm -f ${DESTDIR}/bin/busybox
diff --git a/hooks/klibc b/hooks/klibc
index 8e61d7a..9047199 100755
--- a/hooks/klibc
+++ b/hooks/klibc
@@ -19,7 +19,7 @@ esac
 cp -pnL /usr/lib/klibc/bin/* ${DESTDIR}/bin
 cp -pL /lib/klibc-*.so ${DESTDIR}/lib
 rm -f ${DESTDIR}/bin/kinit* ${DESTDIR}/bin/zcat
-if [ "${BUSYBOX}" = "n" ] || [ ! -e ${BUSYBOXDIR}/busybox ]; then
+if [ "${BUSYBOX}" = "n" ]; then
 	if [ -e ${DESTDIR}/bin/sh.shared ]; then
 		# Some platforms build a shared klibc/sh:
 		mv ${DESTDIR}/bin/sh.shared ${DESTDIR}/bin/sh

-- 
Ben Hutchings
Larkinson's Law: All laws are basically false.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: This is a digitally signed message part
URL: <http://lists.alioth.debian.org/pipermail/pkg-cryptsetup-devel/attachments/20151206/5febfa38/attachment.sig>


More information about the pkg-cryptsetup-devel mailing list