On Thu, 10 Feb 2022 11:49:30 +0100 Lennart Poettering <lennart@xxxxxxxxxxxxxx> wrote: > On Mi, 09.02.22 17:16, Mariusz Tkaczyk > (mariusz.tkaczyk@xxxxxxxxxxxxxxx) wrote: > > > It is probably wrong, but it worked this way for many years: > > "Again: if your code is being run from the root file system, then > > this logic suggested above is NOT for you. Sorry. Talk to us, we can > > probably help you to find a different solution to your problem."[3] > > > > How can I block the service from being stopped? In initramfs there > > is a mdmon restart procedure, for example in dracut[4]. I need to > > save mdmon process from being stopped. > > > > I will try to adapt our implementation to your[3] suggestions but > > it is longer topic, I want to workaround the issue first. > > > > [1]https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git > > [2]https://git.kernel.org/pub/scm/utils/mdadm/mdadm.git/tree/systemd/mdmon@.service > > > > So with that unit systemd shouldn#t stop it the service at all, given > that you set DefaultDependencies=no. > > It would be good to figure out why it is stopped anyway. i.e. check > with "systemctl show" on the unit what kind of requirement/conflicts > deps there are which might explain it. > > Otherwise there might simply be another program that explicitly tells > systemd to shut this stuff down, i.e. some script or so. Turn on debug > logging (systemd-analyze log-level debug) before shutting down, the > logs should tell you a thing or two about why the service is stopped. > That is ridiculous when I enabled debug logging by command provided, it is not killed: [ OK ] Stopped Avahi mDNS/DNS-SD Stack. [ OK ] Stopped irqbalance daemon. [ OK ] Stopped NTP client/server. [ OK ] Stopped libstoragemgmt plug-in server daemon. [ OK ] Stopped Machine Check Exception Logging Daemon. [ OK ] Stopped Self Monitoring an…ing Technology (SMART) Daemon. [ OK ] Stopped Modem Manager. [ OK ] Stopped CUPS Scheduler. [ OK ] Stopped Enable periodic up… of entitlement certificates.. [ OK ] Stopped OpenSSH server daemon. [ OK ] Stopped Deferred execution scheduler. [ OK ] Stopped Command Scheduler. [ OK ] Stopped Getty on tty1. [ OK ] Stopped Serial Getty on ttyS0. [ OK ] Stopped Software RAID monitoring and management. [ OK ] Stopped PackageKit Daemon. [ OK ] Stopped Load/Save Random Seed. [ OK ] Stopped Session 4 of User root. [ OK ] Stopped Session 1 of User root. I was able to step down into systemd-shutdown. Probably, I caused it during debugging (I modified mdmon@.service and reinstalled mdadm package many times). Are you able to explain what happens? Anyway, thanks for help. Now I can move forward. I will open separate thread (if necessary) for other problems because they will be related with systemd-shutdown. Thanks, Mariusz