behaviour of "systemctl kexec" not matching man page, sabotaging kexec reboots with kexec-tools

Timo Weingärtner timo.weingaertner at itscope.de
Thu Feb 20 17:30:19 GMT 2020


Hallo,

some Debian releases ago I used to use kexec-tools to do kexec reboots with 
sysvinit. With the advent of systemd I used "systemctl kexec" with kexec-tools 
installed and it worked as intended. Some time ago it started failing and I 
didn't care because I didn't have bare metal servers running Debian at that 
time. In my current dayjob I'm again responsible for a bunch of servers so I 
resumed to care and researched why "systemctl kexec" fails.

According to systemctl's man page "systemctl kexec" is just an alias for 
"systemctl start kexec.target --job-mode=replace-irreversibly --no-block". If 
I invoke the latter with kexec-tools installed it actually works. If I use 
"systemctl kexec" the error messages are one of:

----8<----8<----8<----
/sbin/kexec is not available: No such file or directory
----8<----8<----8<----

on a system with no kexec-tools installed
which is actually helpful

----8<----8<----8<----
Cannot find the ESP partition mount point.
----8<----8<----8<----

on a buster system with BIOS-boot and kexec-tools installed
which is misleading, because I do not need EFI for kexec to work

----8<----8<----8<----
No entry suitable as default, refusing to guess.
----8<----8<----8<----

on a buster system with EFI-boot and kexec-tools installed
which is highly irritating and not helpful

----8<----8<----8<----
No kexec kernel loaded and autodetection failed.
Automatic loading works only on systems booted with EFI.
----8<----8<----8<----

on a bullseye system with BIOS-boot and kexec-tools installed
which is factually wrong because kexec-tools will do the loading (later) just 
fine

I understand that systemd authors try to tell the user when a fast (kexec) 
reboot is not to be expected, but the heuristic is wrong on all systems I got 
my fingers on. Even if kexec reboots worked on systems with EFI-boot it would 
not be an option to reinstall all the servers.

IMO there are some options to proceed:
1) improve the heuristic in systemctl so that it succeeds if kexec-tools is
   installed, maybe with some option in system.conf.
2) work around the systemd bug in kexec-tools by loading the kernel at boot
   and kernel install times¹, wasting about 40 MiB of RAM.
3) provide a wrapper script (say "kexecreboot") in kexec-tools that runs the
   long version above and also loads a kernel in the case of sysvinit with
   kexec-tools/load_kexec=false.
4) provide a wrapper script and dpkg-divert systemctl.


Grüße
Timo

¹ that would miss kernel cmdline changes with only update-grub, but I couldn't
  find useful hooks for that
-- 
ITscope GmbH
Ludwig-Erhard-Allee 20
D-76131 Karlsruhe

Tel: +49 721 627376-0
Fax: +49 721 66499175

https://www.itscope.com

Handelsregister: AG Mannheim, HRB 232782 Sitz der Gesellschaft: Karlsruhe
Geschäftsführer: Alexander Münkel, Benjamin Mund, Stefan Reger
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20200220/31cd0224/attachment.sig>


More information about the Pkg-systemd-maintainers mailing list