From: Harald Hoyer <har...@redhat.com> Doing a kexec with no kernel loaded would currently issue a normal reboot. This might not be wanted, if the goal of kexec is to circumvent the boot loader. Better fail to kexec, than to reboot into a maybe broken setup. --- src/systemctl/systemctl.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 5a5681b..ac99f44 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -2853,6 +2853,11 @@ static int start_special(sd_bus *bus, char **args) { return -EPERM; } + if (a == ACTION_KEXEC && !kexec_loaded()) { + log_error("No kernel loaded for kexec!"); + return -EINVAL; + } + if (arg_force >= 2 && (a == ACTION_HALT || a == ACTION_POWEROFF || @@ -6711,6 +6716,12 @@ int main(int argc, char*argv[]) { goto finish; } + if (arg_action == ACTION_KEXEC && !kexec_loaded()) { + log_error("No kernel loaded for kexec!"); + r = -EINVAL; + goto finish; + } + if (!avoid_bus()) r = bus_open_transport_systemd(arg_transport, arg_host, arg_scope != UNIT_FILE_SYSTEM, &bus); -- 1.8.5.3 _______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel