Skip to content

Rework shutdown handling

Here is a rework of the shutdown/reboot handling with the following changes:

  1. Make plymouthd always killable (don't set argv[0][0]='@') except when running from the initrd in boot-up mode
  2. Add @halfline's plymouthd-drm-escrow helper from !118 (closed), as explained there the alternative idea to store the fds in systemd through sd_pid_notify_with_fds() does not work
  3. Add @halfline's plymouth-switch-root-initramfs.service from !118 (closed) to switch back to the initramfs on shutdown before executing plymouthd-drm-escrow, so that it does not keep the rootfs busy

This fixes 2 shutdown issues:

  1. plymouthd keeping the rootfs busy, so that it cannot be cleanly unmounted / remounted r-o
  2. plymouthd calling drmModeSetCrtc () after the kms driver's shutdown method has ran, causing flickering (and potential reboot issues)

This is mostly based on !118 (closed) with some small cleanups. I decided to not do a forced-push over the wip/fix-remount-failure branch for this, so that the old version of this will be preserved there.

Compared to !118 (closed) this has the following changes:

  1. Start the escrow helper from main.c instead of from the drm plugin
  2. In the child of the fork, continue with quiting normally (letting the bootsplash become idle) instead of exiting directly
  3. Split over multiple patches (+ some prep / related patches from me)
  4. Fix a couple of typos. Especially the plymouth-populate-initrd.in changes using plymouth-drm-escrow instead of plymouthd-drm-escrow which was causing things to not work because plymouthd-drm-escrow was missing from the initrd.
  5. 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).
  6. Also add plymouth-switch-root-initramfs.service to kexec.target.wants, kexec.target.wants uses --mode=shutdown, so the plymouthd-drm-escrow helper will run, so we need to switch to the initramfs.

Merge request reports