1

On debian stretch with systemd, it is possible to reboot using the systemd command systemctl kexec.

Also, systemd handles all reboots:

# ls -l $(which reboot)
lrwxrwxrwx 1 root root 14 Jul  5  2017 /sbin/reboot -> /bin/systemctl

Because a reboot with full hardware re-initialization takes long and, more importantly, requires to input the crypto passphrase, I would rather always use kexec for reboots.

Is it possible to configure systemd in a way which uses kexec as the default reboot mechanism? (Apart from replacing /sbin/reboot)

Zulakis
  • 4,153
  • 14
  • 48
  • 76

1 Answers1

1

Replace reboot for kexec

  1. Remove or rename the systemd reboot target

    rm /lib/systemd/system/reboot.target

  2. Create a link to the kexec target as the reboot target

    ln -sf /etc/systemd/system/kexec.target /lib/systemd/system/reboot.target

  3. Reload

    systemctl daemon-reload

  4. Take note that with systemd and kexec only one way of rebooting is supported, that's using

    systemctl kexec

Rebooting via the "reboot" command does not work because the kexec-load script run via SysV init wrapper is not loading the kexec kernel unless invoked in the right way. Using kdump might no longer work. Reference: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=785714

Cancel everything

  1. Reinstall systemd

    apt install --reinstall systemd

Florian Heigl
  • 1,479
  • 12
  • 20
A.Barth
  • 11
  • 4
  • Is this using systemd-boot or grub? I use systemd-boot and can kexec using `systemctl kexec` but this method leaves me with a failure. I am on Ubuntu 20.10. – sup Jan 04 '21 at 13:46