specify the controlling terminal for the console.
This is useful, if you have multiple "console=" arguments.
+**action_on_fail=**_{shell|continue}_::
+ Specify the action after failure. By default it's emergency_shell.
+ 'continue' means: ignore the current failure and go ahead.
+
[[dracutkerneldebug]]
Debug
~~~~~
warn "*** Warning -- the system did not shut down cleanly. "
warn "*** Dropping you to a shell; the system will continue"
warn "*** when you leave the shell."
- emergency_shell
+ action_on_fail
fi
fsckoptions="$AUTOFSCK_OPT $fsckoptions"
fi
if [ $ret -eq 3 -o $permissive -eq 0 ]; then
warn "Machine in enforcing mode."
warn "Not continuing"
- emergency_shell -n selinux
- exit 1
+ action_on_fail -n selinux || exit 1
fi
return 0
elif [ $permissive -eq 0 -a "$SELINUX" != "disabled" ]; then
warn "Machine in enforcing mode and cannot execute load_policy."
warn "To disable selinux, add selinux=0 to the kernel command line."
warn "Not continuing"
- emergency_shell -n selinux
- exit 1
+ action_on_fail -n selinux || exit 1
fi
}
fi
main_loop=$(($main_loop+1))
- [ $main_loop -gt $RDRETRY ] && emergency_shell "Could not boot."
+ [ $main_loop -gt $RDRETRY ] && action_on_fail "Could not boot." && break
done
unset job
done
i=$(($i+1))
- [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
+ [ $i -gt 20 ] && action_on_fail "Can't mount root filesystem" && break
done
export -p > /dracut-state.sh
warn "*** Warning -- the system did not shut down cleanly. "
warn "*** Dropping you to a shell; the system will continue"
warn "*** when you leave the shell."
- emergency_shell
+ action_on_fail
fi
_fsckoptions="$AUTOFSCK_OPT $_fsckoptions"
fi
warn "Mounting /usr to $NEWROOT/usr failed"
warn "*** Dropping you to a shell; the system will continue"
warn "*** when you leave the shell."
- emergency_shell
+ action_on_fail
fi
fi
}
[ -e /run/initramfs/.die ] && exit 1
}
+action_on_fail()
+{
+ local _action=$(getarg action_on_fail=)
+ case "$_action" in
+ continue)
+ [ "$1" = "-n" ] && shift 2
+ [ "$1" = "--shutdown" ] && shift 2
+ warn "$*"
+ warn "Not dropping to emergency shell, because 'action_on_fail=continue' was set on the kernel command line."
+ return 0
+ ;;
+ shell)
+ emergency_shell $@
+ return 1
+ ;;
+ *)
+ emergency_shell $@
+ return 1
+ ;;
+ esac
+}
+
# Retain the values of these variables but ensure that they are unexported
# This is a POSIX-compliant equivalent of bash's "export -n"
export_n()
rm -fr /newrun
fi
-trap "emergency_shell Signal caught!" 0
+trap "action_on_fail Signal caught!" 0
[ -d /run/initramfs ] || mkdir -p -m 0755 /run/initramfs
[ -d /run/log ] || mkdir -p -m 0755 /run/log
main_loop=$(($main_loop+1))
[ $main_loop -gt $RDRETRY ] \
- && { flock -s 9 ; emergency_shell "Could not boot."; } 9>/.console_lock
+ && { flock -s 9 ; action_on_fail "Could not boot." && break; } 9>/.console_lock
done
unset job
unset queuetriggered
i=$(($i+1))
[ $i -gt 20 ] \
- && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
+ && { flock -s 9 ; action_on_fail "Can't mount root filesystem" && break; } 9>/.console_lock
done
{
[ "$INIT" ] || {
echo "Cannot find init!"
echo "Please check to make sure you passed a valid root filesystem!"
- emergency_shell
+ action_on_fail
}
if [ $UDEVVERSION -lt 168 ]; then
warn "Command:"
warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs
warn "failed."
- emergency_shell
+ action_on_fail
}
else
unset RD_DEBUG
exec $SWITCH_ROOT "$NEWROOT" "$INIT" $initargs || {
warn "Something went very badly wrong in the initramfs. Please "
warn "file a bug against dracut."
- emergency_shell
+ action_on_fail
}
fi