diff --git a/dracut.8 b/dracut.8 index 5a9965ab..fccd574b 100644 --- a/dracut.8 +++ b/dracut.8 @@ -286,7 +286,7 @@ print informational output though "quiet" is set allow dropping to a shell, if root mounting fails .TP .B rdinitdebug -set -x for the dracut shell +set -x for the dracut shell and logs to dmesg, console and /init.log .TP .B rdbreak drop to a shell at the end diff --git a/modules.d/99base/init b/modules.d/99base/init index a8144466..4b45b371 100755 --- a/modules.d/99base/init +++ b/modules.d/99base/init @@ -7,7 +7,10 @@ emergency_shell() { - exec >/dev/console 2>&1 /dev/console 1<>/dev/console 2<>/dev/console + # wait for loginit + wait echo ; echo echo $@ source_all emergency @@ -50,6 +53,12 @@ if [ ! -c /dev/ptmx ]; then fi fi +if getarg rdinitdebug; then + getarg quiet && DRACUT_QUIET="yes" + mkfifo /dev/initlog.pipe + /sbin/loginit $DRACUT_QUIET /dev/console 2>&1 & + exec >/dev/initlog.pipe 2>&1 +fi setdebug mkdir /dev/shm @@ -244,6 +253,10 @@ fi info "Switching root" +exec 0<>/dev/console 1<>/dev/console 2<>/dev/console +# wait for loginit +wait + exec switch_root "$NEWROOT" "$INIT" $initargs || { echo "Something went very badly wrong in the initramfs. Please " echo "file a bug against dracut." diff --git a/modules.d/99base/install b/modules.d/99base/install index 8cd0babd..801c8d75 100755 --- a/modules.d/99base/install +++ b/modules.d/99base/install @@ -1,6 +1,6 @@ #!/bin/bash dracut_install mount mknod mkdir modprobe pidof sleep chroot \ - sed ls flock cp mv dmesg rm ln rmmod + sed ls flock cp mv dmesg rm ln rmmod mkfifo less if [ ! -e "${initdir}/bin/sh" ]; then dracut_install bash (ln -s bash "${initdir}/bin/sh" || :) @@ -8,6 +8,7 @@ fi # install our scripts and hooks inst "$moddir/init" "/init" inst "$moddir/initqueue" "/sbin/initqueue" +inst "$moddir/loginit" "/sbin/loginit" mkdir -p ${initdir}/initqueue mkdir -p ${initdir}/initqueue-finished mkdir -p ${initdir}/initqueue-settled