Cleanup dead systemd services before start sysroot.mount

When kdump failed due to initqueue timeout, the sysroot.mount and other
serivces could be stuck in `start` but `dead` status:

Example output of systemctl:

dev-disk-by\x2duuid-530830d1\x2df2c7\x2d4c9a\x2d9a82\x2d148609097521.device loaded inactive   dead    start
<... snip ...>
squash-root.mount		loaded active     mounted       /squash/root
squash.mount			loaded active     mounted       /squash
sysroot.mount			loaded inactive   dead    start /sysroot
<... snip ...>
dracut-cmdline.service		loaded active     exited        dracut cmdline hook
dracut-initqueue.service	loaded activating start   start dracut initqueue hook
dracut-mount.service		loaded inactive   dead    start dracut mount hook

At this point calling `systemctl start sysroot.mount` will just hang as
systemd will just wait for the services that are stuck in `start`
status. So call `systemctl cancel` here to cancel all pending jobs and
have a clean start for mounting sysroot.

Signed-off-by: Kairui Song <kasong@redhat.com>
Acked-by: Coiby Xu <coxu@redhat.com>
This commit is contained in:
Kairui Song 2021-07-02 03:27:05 +08:00
parent 7dbbb4bb31
commit 2603ba7187

View File

@ -227,6 +227,8 @@ dump_to_rootfs()
systemctl start dracut-initqueue systemctl start dracut-initqueue
fi fi
dinfo "Clean up dead systemd services"
systemctl cancel
dinfo "Waiting for rootfs mount, will timeout after 90 seconds" dinfo "Waiting for rootfs mount, will timeout after 90 seconds"
systemctl start sysroot.mount systemctl start sysroot.mount