EOF
umount_all
- busybox_applet switch_root
+ busybox_applet switch_root usleep
add_linuxrc <<-'EOF'
[ ! -e /newroot/dev/console ] && mknod -m 660 /newroot/dev/console c 5 1
+
+ # switch root to empty dir will make kernel panic, so sleep 10s before it
+ # switch_root needs to be pid 1, so there's no other way to recover from here
+ # if /dev is missing, switch root will likely fail, give debug shell before that
+ if [ ! -d /newroot/dev ]; then
+ echo "/dev is missing, switch_root will likely fail"
+ echo "if you booted with debugrd=sh, then you be given shell and you might able to recover this situation"
+ debugshell
+ [ "$DEBUGINITRD" ] || usleep 10000000
+ fi
+
exec switch_root /newroot $init ${1:+"$@"}
+ # FIXME: this code is never executed, as "exec" does not return!
+
echo "Error! initramfs should not reach this place."
echo "It probably means you've got old version of busybox, with broken"
echo "initramfs support. Trying to boot anyway, but won't promise anything."
EOF
if is_yes "$RUN_SULOGIN_ON_ERR"; then
add_linuxrc <<-'EOF'
- echo "debug shell disabled by /etc/sysconfig/system: RUN_SULOGIN_ON_ERR setting"
+ echo "debug shell disabled by RUN_SULOGIN_ON_ERR=yes from /etc/sysconfig/system during initrd generation time"
EOF
else
add_linuxrc <<-'EOF'