Doing kexec reboot right in systemd

Marti Raudsepp marti at juffo.org
Thu Mar 22 15:14:56 EDT 2012


Hi list,

I was recently pondering how systemd could use kexec "properly", in a
reasonably general way, to make reboots faster. I exchanged an email
with Poettering on the systemd list and he suggested me to ask here.

My current proposal:
1. Include a template 'kexec-load.service' with kexec-tools, which
distros/users could customize to load the right kernel and initrd via
/sbin/kexec

2. If the user does 'systemctl enable kexec-load.service', then this
service would trigger before every reboot. Loading the kernel any
earlier would waste memory (5+14 MB on Ubuntu Server). Also a common
reason for rebooting is to boot into a newly-installed kernel. Loading
it any earlier would boot you into an older kernel.

3. During a reboot, after systemd has finished shutting down, it
detects via /sys/kernel/kexec_loaded whether the kexec kernel is
loaded. If 1, it performs a 'kexec -e'. If not, it does a normal
reboot.

----

Lennart commented on #2 that kexec might have problems finding
contiguous memory to load the kernel into, this late in the lifecycle.
Do you think this is a deal-breaker for such a feature? If it's rare
enough, then it might not be a problem -- we can always fall back to a
normal reboot.

I'm also assuming that "kexec --load" will fail atomically -- that it
won't try to boot a half-loaded kernel, or boot a kernel whose initrd
failed to load.

Also, #3 doesn't yet work that way in systemd (currently it detects
before shutdown) and Poettering hasn't agreed yet.

Does this proposal seem sane to kexec folks? Did I miss anything?

----

Here are my and Poettering's initial thoughts on this matter:
http://lists.freedesktop.org/archives/systemd-devel/2012-March/004760.html
http://lists.freedesktop.org/archives/systemd-devel/2012-March/004764.html

PS: I hope I haven't broken any rules by cross-posting this. This
question seems relevant to both projects.

Regards,
Marti



More information about the kexec mailing list