Hello. (Coming via https://lists.freedesktop.org/archives/systemd-devel/2022-August/048201.html.) On Tue, Aug 02, 2022 at 05:43:05PM +0200, Mariusz Tkaczyk <mariusz.tkaczyk@xxxxxxxxxxxxxxx> wrote: > https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/udev-md-raid-arrays.rules#n41 > but i can't find wants dependency in: > #systemctl show dev-md126.service > #systemctl show dev-md127.service Typo here s/service/device/ But the Wants dependency won't help with shutdown ordering. > I got: > systemd[1]: /usr/lib/systemd/system/mdmon@.service:11: Failed to resolve unit > specifiers in 'dev-%I.device', ignoring: Invalid slot What was your exact directive in service unit file and what was the template parameter? (This may not work though, since there'd be no stop job for .device unit during shutdown to order against. (not tested)) > Probably it tries to umount every exiting .mount unit, i didn't check deeply. > https://www.freedesktop.org/software/systemd/man/systemd.mount.html > > I can see that we can define something for .mount units so I tried both: > # mount -o x-systemd.after=mdmon@md127.service /dev/mapper/vg0-lvm_raid /mnt > # mount -o x-systemd.requires=mdmon@md127.service /dev/mapper/vg0-lvm_raid /mnt > > but I doesn't help either. I seems that it is ignored because I cannot find > mdmon dependency in systemctl show output for mnt.mount unit. These x-* options are parsed from fstab. If you mount manually like this, systemd won't learn about these non-kernel options (they don't get through /proc/mountinfo). Actually, I think if you add the .mount:After=mdmon@....service (via fstab), it should properly order the stop of mdmon after the particular unmount during shutdown. HTH, Michal