Bug#660297: initramfs-tools: busybox's switch_root doesn't handle /proc or /sys moving
Package: initramfs-tools
Version: 0.100
Severity: normal
Tags: patch
Greetings.
the change to using switch_root leaves /sys and /proc in an unmounted state.
busybox's switch_root doesn't appear to handle the /sys and /proc moving the
way that util-linux's switch_root does.
either busybox's switch_root should be fixed, initramfs-tools uses util-linux's
switch_root, or manually handle mounting the dirs, just like how it's done with
run-init. the following patch implements the last approach.
live well,
vagrant
commit 705c5e3529536862135d90e1d710d02d750765d7
Author: Vagrant Cascadian <vagrant@freegeek.org>
Date: Fri Feb 17 16:11:32 2012 -0800
Work around busybox's switch_root, which doesn't handle moving /proc and /sys
into the root before switching, by moving the /proc and /sys directories
directly.
Signed-off-by: Vagrant Cascadian <vagrant@debian.org>
diff --git a/init b/init
index 472b279..242b29d 100755
--- a/init
+++ b/init
@@ -310,13 +310,14 @@ unset readonly
unset resume
unset resume_offset
+# Move virtual filesystems over to the real filesystem
+mount -n -o move /sys ${rootmnt}/sys
+mount -n -o move /proc ${rootmnt}/proc
+
# Chain to real filesystem
if command -v switch_root >/dev/null 2>&1; then
exec switch_root ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console
elif command -v run-init >/dev/null 2>&1; then
- # Move virtual filesystems over to the real filesystem
- mount -n -o move /sys ${rootmnt}/sys
- mount -n -o move /proc ${rootmnt}/proc
exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console
fi
Reply to: