"systemctl kexec" reboots

Bug #1862300 reported by Alex Badea
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
finalrd (Ubuntu)
Won't Fix
Undecided
Unassigned
kexec-tools (Ubuntu)
Fix Released
High
Unassigned

Bug Description

After the introduction of finalrd, "systemctl kexec" (with a kernel preloaded by "kexec -l ...") no longer kexec()s -- it reboots instead.

Can be reproduced for example using a livecd (say, xubuntu-18.04-desktop-amd64.iso):

sudo -i
apt-get update
apt-get install kexec-tools finalrd
systemctl start finalrd # optional
kexec -l /cdrom/casper/vmlinuz
systemctl kexec

Expected results: the system kexec's into the kernel and panics (due to lack of /init, since we haven't given it an initrd).

Actual results: the system reboots (e.g. the livecd's bootloader menu runs).

If we don't install "finalrd" above, kexec works normally.

Revision history for this message
Alex Badea (vamposdecampos) wrote :

Turns out, systemd's shutdown implementation fork/execs the kexec binary from kexec-tools; this is missing from the /run/initramfs finalrd. systemd then falls through to reboot: https://github.com/systemd/systemd/blob/a859abf062cef1511e4879c4ee39c6036ebeaec8/src/shutdown/shutdown.c#L557

One way to fix it might be for finalrd to "copy_exec /sbin/kexec" if it exists. Alternatively, the kexec-tools package might ship a finalrd hook instead.

affects: finalrd → kexec-tools (Ubuntu)
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Yes, kexec-tools should ship finalrd hook to fix this.

Changed in finalrd (Ubuntu):
status: New → Won't Fix
Changed in kexec-tools (Ubuntu):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package kexec-tools - 1:2.0.20-2.1ubuntu2

---------------
kexec-tools (1:2.0.20-2.1ubuntu2) groovy; urgency=medium

  * Add finalrd integration hook, to allow kexec with finalrd. LP:
    #1862300

 -- Dimitri John Ledkov <email address hidden> Thu, 10 Sep 2020 15:33:48 +0100

Changed in kexec-tools (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.