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."
- action_on_fail
+ emergency_shell
fi
fsckoptions="$AUTOFSCK_OPT $fsckoptions"
fi
main_loop=$(($main_loop+1))
if [ $main_loop -gt $RDRETRY ]; then
if ! [ -f /sysroot/etc/fstab ] || ! [ -e /sysroot/sbin/init ] ; then
- action_on_fail "Could not boot." && break
+ emergency_shell "Could not boot."
fi
warn "Not all disks have been found."
warn "You might want to regenerate your initramfs."
done
i=$(($i+1))
- [ $i -gt 20 ] && action_on_fail "Can't mount root filesystem" && break
+ [ $i -gt 20 ] && emergency_shell "Can't mount root filesystem"
done
export -p > /dracut-state.sh
if [ $ret -eq 3 -o $permissive -eq 0 ]; then
warn "Machine in enforcing mode."
warn "Not continuing"
- action_on_fail -n selinux || exit 1
+ emergency_shell -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"
- action_on_fail -n selinux || exit 1
+ emergency_shell -n selinux
+ exit 1
fi
}
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."
- action_on_fail
+ emergency_shell
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."
- action_on_fail
+ emergency_shell
fi
fi
}
fi
}
-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()
done
fi
-trap "action_on_fail Signal caught!" 0
+trap "emergency_shell Signal caught!" 0
export UDEVVERSION=$(udevadm --version)
if [ $UDEVVERSION -gt 166 ]; then
main_loop=$(($main_loop+1))
[ $main_loop -gt $RDRETRY ] \
- && { flock -s 9 ; action_on_fail "Could not boot." && break; } 9>/.console_lock
+ && { flock -s 9 ; emergency_shell "Could not boot."; } 9>/.console_lock
done
unset job
unset queuetriggered
_i_mount=$(($_i_mount+1))
[ $_i_mount -gt 20 ] \
- && { flock -s 9 ; action_on_fail "Can't mount root filesystem" && break; } 9>/.console_lock
+ && { flock -s 9 ; emergency_shell "Can't mount root filesystem"; } 9>/.console_lock
done
{
[ "$INIT" ] || {
echo "Cannot find init!"
echo "Please check to make sure you passed a valid root filesystem!"
- action_on_fail
+ emergency_shell
}
if [ $UDEVVERSION -lt 168 ]; then
warn "Command:"
warn capsh --drop=$CAPS_INIT_DROP -- -c exec switch_root "$NEWROOT" "$INIT" $initargs
warn "failed."
- action_on_fail
+ emergency_shell
}
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."
- action_on_fail
+ emergency_shell
}
fi