[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#845302: systemd: 232-6:Failed to boot, makes kernel panic when starting /sbin/init.



Am 23.11.2016 um 14:30 schrieb Michael Biebl:

> I'm going to reassign this to initramfs-tools as it uses mount
> implementations from either klibc-utils or busybox which are both
> incomplete and as a result, fail to mount /usr.
> 
> I decided against reassigning this to busybox and klibc-utils.
> I think it's preferable, if initramfs-tools simply uses the mount
> implementation from the real systemd, i.e. util-linux. This guarantees
> that we won't run into such problems again in the future.
> 
> The mount utility is tiny, all its library dependencies are already in
> the initramfs. Rebuilding the initramfs with mount from u-l increases
> the size by 17K.
> 
> We would also have to make sure to use mount --move in
> /usr/share/initramfs-tools/init for /run, /sys and /proc
> 
> Ben, what's your take on this?

Something like the attached patch should do the trick.
I wonder though, if we should use the other tools from mount as well,
like umount, swapon/off

Feedback welcome.


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
From dd370d9b7242624f67e6263177997446e01705ba Mon Sep 17 00:00:00 2001
From: Michael Biebl <biebl@debian.org>
Date: Wed, 23 Nov 2016 15:54:38 +0100
Subject: [PATCH] Use mount implementation from util-linux

It's also used on the real system and seems to be the only complete
implementation.

Closes: #845302
---
 debian/control |  2 +-
 hooks/mount    | 23 +++++++++++++++++++++++
 init           |  6 +++---
 3 files changed, 27 insertions(+), 4 deletions(-)
 create mode 100755 hooks/mount

diff --git a/debian/control b/debian/control
index fc9cb7b..813fde5 100644
--- a/debian/control
+++ b/debian/control
@@ -25,7 +25,7 @@ Package: initramfs-tools-core
 Architecture: all
 Multi-Arch: foreign
 Recommends: ${busybox:Recommends}
-Depends: klibc-utils (>= 2.0.4-8~), cpio, kmod | module-init-tools, udev, ${misc:Depends}
+Depends: klibc-utils (>= 2.0.4-8~), mount, cpio, kmod | module-init-tools, udev, ${misc:Depends}
 Suggests: bash-completion
 Breaks: initramfs-tools (<< 0.121~)
 Replaces: initramfs-tools (<< 0.121~)
diff --git a/hooks/mount b/hooks/mount
new file mode 100755
index 0000000..1464533
--- /dev/null
+++ b/hooks/mount
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+PREREQ="klibc-utils"
+
+prereqs()
+{
+	echo "$PREREQ"
+}
+
+case $1 in
+prereqs)
+	prereqs
+	exit 0
+	;;
+esac
+
+. /usr/share/initramfs-tools/hook-functions
+
+# We pulled in klibc-utils, to make sure we run after it,
+# so we can replace the symlink
+rm -f ${DESTDIR}/bin/mount
+copy_exec /bin/mount
+
diff --git a/init b/init
index 9552e5c..886a55e 100755
--- a/init
+++ b/init
@@ -248,7 +248,7 @@ run_scripts /scripts/init-bottom
 [ "$quiet" != "y" ] && log_end_msg
 
 # Move /run to the root
-mount -n -o move /run ${rootmnt}/run
+mount -n --move /run ${rootmnt}/run
 
 validate_init() {
 	run-init -n "${rootmnt}" "${1}"
@@ -299,8 +299,8 @@ unset forcefsck
 unset fsckfix
 
 # Move virtual filesystems over to the real filesystem
-mount -n -o move /sys ${rootmnt}/sys
-mount -n -o move /proc ${rootmnt}/proc
+mount -n --move /sys ${rootmnt}/sys
+mount -n --move /proc ${rootmnt}/proc
 
 # Chain to real filesystem
 exec run-init ${drop_caps} ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1
-- 
2.10.2

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: