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@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@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.
Attachment:
signature.asc
Description: This is a digitally signed message part