systemd: Add plymouth-switch-root-initramfs.service to switch back to initramfs on shutdown

System Internals / Plymouth - Ray Strode [redhat.com] - 6 April 2021 11:45 UTC

Add a plymouth-switch-root-initramfs.service, which will call "plymouth update-root-fs --new-root-dir=/run/initramfs" to switch back to the initramfs (when applicable).

Systemd will run this service before plymouthd receives the SIGTERM on shutdown, so this will cause the plymouthd-fd-escrow helper to run from the initramfs.

This avoids the plymouthd-fd-escrow helper keeping the rootfs busy.

Changes by Hans de Goede:- Fix a couple of typos- Add Conflicts=dracut-shutdown.service to plymouth-switch-root-initramfs.service dracut-shutdown.service restores the initramfs when it is _stopped_ use Conflicts to make sure its ExecStop has run before we do- Add a check for switching back to the initramfs to on_newroot () and dump the debug-buffer before the switch (while we still have access to /var/log).
- Also add plymouth-switch-root-initramfs.service to kexec.target.wants. kexec.target.wants uses --mode=shutdown, so the plymouthd-fd-escrow helper will run, so we need to switch to the initramfs.

2a7755f systemd: Add plymouth-switch-root-initramfs.service to switch back to initramfs on shutdown
configure.ac | 1 +
scripts/plymouth-populate-initrd.in | 2 ++
src/main.c | 7 ++++
systemd-units/Makefile.am | 37 +++++++++++++++-------
.../plymouth-switch-root-initramfs.service.in | 15 +++++++++
5 files changed, 50 insertions(+), 12 deletions(-)

Upstream: cgit.freedesktop.org


  • Share