systemctl: if kexec fails with --force, continue to reboot normally

When we are in late shutdown, and for whatever reason kexec fails, we should
proceed with a normal reboot. Network is down and sessions have been terminated
when we attempt to do the kexec, so rebooting normally is a better solution.

Logs from the case where the kexec kernel is not usable:
Mar 08 11:23:10 fuefi systemd[1]: Reached target Final Step.
Mar 08 11:23:10 fuefi systemd[1]: Starting Reboot via kexec...
Mar 08 11:23:10 fuefi systemctl[1480]: Cannot find the ESP partition mount point.
Mar 08 11:23:10 fuefi systemctl[1480]: Failed to load kexec kernel, continuing without.
Mar 08 11:23:10 fuefi systemd[1]: Shutting down.
... and then we proceed to do a normal reboot

Related to #7730.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-03-09 10:43:54 +01:00
parent c0d7321498
commit d23b5ce2b6
+3 -1
View File
@@ -3603,7 +3603,9 @@ static int start_special(int argc, char *argv[], void *userdata) {
} else if (a == ACTION_KEXEC) {
r = load_kexec_kernel();
if (r < 0)
if (r < 0 && arg_force >= 1)
log_notice("Failed to load kexec kernel, continuing without.");
else if (r < 0)
return r;
} else if (a == ACTION_EXIT && argc > 1) {