sys-apps/kexec-tools provides /etc/init.d/kexec which greatly speeds up reboots. It would be nice if systemd would have similar support.
I think the "systemctl kexec" option has this already implemented in terms of a kexec.target, at least with version systemd-44-r1. I haven't actually tried it. Does that do what you want?
(In reply to comment #1)
> I think the "systemctl kexec" option has this already implemented in terms
> of a kexec.target, at least with version systemd-44-r1. I haven't actually
> tried it. Does that do what you want?
Do you know how it works? I.e. whether it mounts /boot, how it finds the kernel to execute, etc? Is it installed via "systemctl enable kexec.target"?
See for example: http://lists.freedesktop.org/archives/systemd-devel/2012-March/004760.html
It appears that the issue is not entirely solved within systemd, but needs a service file to load the kernel as an additional step.
Also see: http://lists.freedesktop.org/archives/systemd-devel/2012-March/004782.html
The solution discussed there does not seem to be implemented in systemd git yet, since I cannot find any reference to kexec-load in the repo.
In any case it seems you need to customize the service file for your particular kernel. I guess it is best to ask on the systemd (or kexec) mailing list for help on this.
(In reply to comment #4)
> In any case it seems you need to customize the service file for your
> particular kernel.
/etc/init.d/kexec did this pretty well and automatic. Can't we just continue to use that script?
(In reply to comment #5)
> (In reply to comment #4)
> > In any case it seems you need to customize the service file for your
> > particular kernel.
> /etc/init.d/kexec did this pretty well and automatic. Can't we just continue
> to use that script?
Since I have virtually no idea about kexec, you are probably better off discussing this on the systemd or kexec mailing lists, and with the gentoo kexec-tools maintainer (feel free to cc me). The script could be used as the basis for two new command-line options to kexec (or a wrapper). The first to try to determine the kernel image and initrd automatically. The second to read these from a configuration file.
Also note that the script is an openrc script, not sysvinit, so it is most likely incompatible with systemd.
Created attachment 346182 [details]
kexec-load@.service file, copied from Arch  and adapted to Gentoo.
Created attachment 346184 [details]
I use attached hook to enable the last-built kernel version for kexec-load. Since only one kernel can be loaded, the script disables all previously installed kexec-load@.services.
Place this file in /etc/kernel/postinst.d/90_kexec, mark it executable (chmod +x) and run "make install" in your kernel sources.
(In reply to comment #7)
> adapted to Gentoo
Gentoo has kexec in /usr/sbin instead of /sbin and the -gentoo suffix to kernel names requires %i (raw instance name) to be used instead of %I (unescaped instance name) -- otherwise a version like 3.8.8-gentoo ends up as 3.8.8/gentoo when systemd unescapes it for the ExecStart commandline.
* If you do not want to use the kernel/postinst.d hook, you can run following command manually instead:
# systemctl enable firstname.lastname@example.org
* This requires /boot/vmlinuz-3.8.8-gentoo and /boot/initramfs-3.8.8-gentoo.img to exist (adapt accordingly for other kernel versions).
* You have to ensure yourself that only one such service is enabled at a time. No idea what happens otherwise -- probably a random kernel is loaded instead of the one you expect (the one whose service file systemd executes last).
Thanks! I committed your changes.
(In reply to comment #10)
> Thanks! I committed your changes.
Thanks a bunch! Good idea warning the user in pkg_postinst about the kernel/postinst.d file and not making it executable by default. :)