You are not logged in.

#1 2013-08-09 10:36:23

aweb
Member
Registered: 2010-12-18
Posts: 24

How to run something on shutdown before file systems unmounted

I've been trying to get kexec working with systemd, following the advice on this wiki page:

https://wiki.archlinux.org/index.php/Kexec#Systemd

Unfortunately, the suggested unit file does not work for me.  The problem is that no matter what I do, my /boot file system gets unmounted before kexec gets run (so that it cannot find the kernel).  I've tried adding most subsets of the following to the Unit section of my kexec-load@.service file, all to no avail:

Before=shutdown.target umount.target final.target
RequiresMountsFor=/boot/vmlinuz-linux
Wants=boot.mount
After=boot.mount

If I run "systemctl start kexec-load@linux" followed by "systemctl kexec", everything works fine.  But if I forget to do the former, then the kexec fails.

Anyway, I'm finding it super frustrating not to be able to control the order of events on shutdown.  There has to be a way to do it, but absolutely nothing I've tried seems to make any difference.  On startup I can obviously control things, so I could have some dummy service that does nothing on start but on stop calls kexec.  But I don't want kexec called on an ordinary reboot or poweroff, only after "systemctl kexec."

If someone could tell me how to do what I need to do, I would much appreciate it.

Offline

Board footer

Powered by FluxBB