emergency_shell()
{
exec >/dev/console 2>&1 </dev/console
+ echo ; echo
+ echo $@
getarg rdinitdebug || dmesg
source_all emergency
- echo ; echo
- echo "Bug in initramfs /init detected. Dropping to a shell. Good luck!"
- echo
- sh -i
+ if getarg rdshell; then
+ echo ; echo
+ echo "Dropping to a shell. Good luck!"
+ echo
+ sh -i
+ else
+ while :; do sleep 1;done
+ fi
}
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
NEWROOT="/sysroot"
-trap "emergency_shell" 0
+trap "emergency_shell Unkown signal caught!" 0
. /lib/dracut-lib.sh
UDEVVERSION=$(udevadm --version)
# run scriptlets to parse the command line
-getarg 'rdbreak=cmdline' && emergency_shell
+getarg 'rdbreak=cmdline' && emergency_shell "Break before cmdline"
source_all cmdline
[ -z "$root" ] && die "No or empty root= argument"
} > /tmp/root.info
# pre-udev scripts run before udev starts, and are run only once.
-getarg 'rdbreak=pre-udev' && emergency_shell
+getarg 'rdbreak=pre-udev' && emergency_shell "Break before pre-udev"
source_all pre-udev
# start up udev and trigger cold plugs
# no more udev jobs
sleep 0.5
i=$(($i+1))
- [ $i -gt 20 ] && getarg rdshell \
- && { flock -s 9 ; emergency_shell; } 9>/.console_lock
+ [ $i -gt 20 ] \
+ && { flock -s 9 ; emergency_shell "No root device found"; } 9>/.console_lock
fi
done
unset job
# pre-mount happens before we try to mount the root filesystem,
# and happens once.
-getarg 'rdbreak=pre-mount' && emergency_shell
+getarg 'rdbreak=pre-mount' && emergency_shell "Break pre-mount"
source_all pre-mount
-getarg 'rdbreak=mount' && emergency_shell
+
+getarg 'rdbreak=mount' && emergency_shell "Break mount"
# mount scripts actually try to mount the root filesystem, and may
# be sourced any number of times. As soon as one suceeds, no more are sourced.
i=0
done
i=$(($i+1))
- [ $i -gt 20 ] && getarg rdshell \
- && { flock -s 9 ; emergency_shell; } 9>/.console_lock
+ [ $i -gt 20 ] \
+ && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
done
# pre pivot scripts are sourced just before we switch over to the new root.
[ -f "$NEWROOT$i" -a -x "$NEWROOT$i" ] && { INIT="$i"; break; }
done
[ "$INIT" ] || {
- echo "Cannot find init! Please check to make sure you passed"
- echo "a valid root filesystem! Dropping to a shell."
+ echo "Cannot find init!"
+ echo "Please check to make sure you passed a valid root filesystem!"
emergency_shell
}
-net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1234 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
+ -append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
if [[ $? -ne 0 ]] || ! grep -m 1 -q nfs-OK client.img; then
-net nic,macaddr=52:54:00:12:34:00,model=e1000 \
-net socket,mcast=230.0.0.1:1235 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "root=dhcp rw quiet console=ttyS0,115200n81 $DEBUGFAIL" \
+ -append "root=dhcp rw quiet console=ttyS0,115200n81 rdshell $DEBUGFAIL" \
-initrd initramfs.testing
grep -m 1 -q iscsi-OK client.img || return 1
}
-net nic,macaddr=$mac,model=e1000 \
-net socket,mcast=230.0.0.1:1236 \
-kernel /boot/vmlinuz-$KVERSION \
- -append "$cmdline $DEBUGFAIL ro quiet console=ttyS0,115200n81" \
+ -append "$cmdline $DEBUGFAIL rdshell ro quiet console=ttyS0,115200n81" \
-initrd initramfs.testing
if [[ $? -ne 0 ]] || ! grep -m 1 -q nbd-OK flag.img; then