Kexec warm rebooting broken in Stretch?

If none of the more specific forums is the right place to ask

Kexec warm rebooting broken in Stretch?

Postby nigratruo » 2018-04-27 11:41


I used kexec for warm reboots in the past (before systemd) and it worked wonderfully, cutting down on boot times. Now I saw that it got integrated into systemd, which allows it potentially to be set as a default reset method and it does not work at all anymore.
Executing kexec-tools -e
Nothing has been loaded!

So it seem that it is not configured at all, not loading the kernel. Am I now expected to configure this all by hand? Adjust it everytime I use a new kernel?
This used to be all automatic.
I have seen there is some unofficial script called kexec-reboot which seems to provide this functionality. Is this now the right way to go? Is there any automatism left in the deb package kexec-tools?
Posts: 17
Joined: 2017-08-12 22:46

Re: Kexec warm rebooting broken in Stretch?

Postby nigratruo » 2018-04-30 03:46

I'm aware of that article, it does not mention how to do this on systemd, all the link does is point to all packages that contain systemd, any relevant info is missing. Really not helpful at all.
dpkg-reconfigure kexec-tools only brings up the config dialog that says:

│ If you choose this option, a system reboot will trigger a restart into a kernel loaded by kexec instead of going through the full system boot
│ loader process.

│ Should kexec-tools handle reboots (sysvinit only)?

Now you might remember that stretch does not use sysvinit anymore.
Posts: 17
Joined: 2017-08-12 22:46

Re: Kexec warm rebooting broken in Stretch?

Postby Wheelerof4te » 2018-04-30 13:04

I think that systemd was in part (a tiny bit part) designed so that people wouldn't have to hack their systems to get better boot times.
Posts: 1418
Joined: 2015-08-30 20:14

Re: Kexec warm rebooting broken in Stretch?

Postby nigratruo » 2018-05-01 03:36

That is definitely true. I have had faster boot times with systemd. Although when you reboot a system, most time is eaten up by the BIOS, which runs in SLOWMO. In servers, every controller performs the initialization and self test, which can sometimes take up to 5 minutes in which the system is doing nothing and is waiting to boot up.
I used this kexec in the past and it blew me away at how fast a system restart takes, that was before systemd even. But now, with systemd it does not work anymore and seems to be broken. I will investigate why the package exists still, but is not properly setup to use the standard systemd system that every Debian stretch comes with. So far all I got were just normal cold restarts and could not produce a warm restart yet.
Posts: 17
Joined: 2017-08-12 22:46

Re: Kexec warm rebooting broken in Stretch?

Postby pylkko » 2018-05-01 18:41

The man page says:
Using kexec consists of

(1) loading the kernel to be rebooted to into memory, and
(2) actually rebooting to the pre-loaded kernel.

To load a kernel, the syntax is as follows:

kexec -l kernel-image --append=command-line-options

where kernel-image is the kernel file that you intend to reboot to....

... After this kernel is loaded, it can be booted to at any time using
the command:

kexec -e

Since you are getting the error "nothing loaded", did you do the above two steps?

Not at a Debian machine now, but check if there is not already a .service or .target for kexec, or try "systemctl kexec".

My understanding is that if you want a clean shutdown with safe unmounting etc. you need to create a service for this (and use systemd-boot)
User avatar
Posts: 1520
Joined: 2014-11-06 19:02

Re: Kexec warm rebooting broken in Stretch?

Postby nigratruo » 2018-05-12 12:19

So my point is that currently, kexec is broken in the state it is in, it does not work automatically. I'm mentioning this because I think that it was the assumption before that after the package was installed, that the system would be ready for using with systemctl kexec. At least it did configure and work automatically before the systemd introduction.
I have experimented with it and when the kernel is manually loaded with kexec by doing:

kexec -l /vmlinuz --initrd=/initrd.img

you can see if the kernel got properly loaded by doing

cat /sys/kernel/kexec_loaded

which returns 1 if it got loaded properly.


systemctl kexec

will do a fast warm reboot.

So the problem is that for some reason the kernel does not automatically get loaded, even though I correctly specified which in the config file here:

# Defaults for kexec initscript
# sourced by /etc/init.d/kexec and /etc/init.d/kexec-load

# Load a kexec kernel (true/false)

# Kernel and initrd image

# If empty, use current /proc/cmdline

# Load the default kernel from grub config (true/false)

(I edited this file, as LOAD_KEXEC and USE_GRUB was set to false.)

There used to be a bug open about this breaking in Jessie and it looks like this has not been fixed in Stretch neither.
The culprit seems to be the script


which is suppose to load the kernel, but does not. I have not quite been able to understand how the mechanism works in kexec on systemd, so it is hard for me to tell if it is misconfigured to run on systemd (it is originally from sysvinit) OR if there is a bug preventing it from loading the kernel.
As I could gather from the above script, it does nothing with the start command, but becomes active when it gets the stop command, is supposed to load the kernel when shutting down and then as the next step, executes kexec for the warm reboot after all the filesystems have been unmounted.

I'm relatively new to systemd and still learning it and so far I could not find out a way to show which tasks my systemd sequence of commands the system runs when shutting down and when (or if at all) kexec-load gets executed.
Posts: 17
Joined: 2017-08-12 22:46

Return to General Questions

Who is online

Users browsing this forum: quixote and 10 guests