When sys-fs/mdadm is emerged on systemd systems, it adds a service "mdmonitor.service" which is the equivalent to the OpenRC service "mdadm". But "mdmonitor.service" fails to start with the error message mdadm: No mail address or alert command - not monitoring. Here is an excerpt from the service file: ########################### [Service] Environment= MDADM_MONITOR_ARGS=--scan EnvironmentFile=-/run/sysconfig/mdadm ExecStartPre=-/usr/lib/systemd/scripts/mdadm_env.sh ExecStart=/sbin/mdadm --monitor $MDADM_MONITOR_ARGS ########################### Reasons: - not enough arguments for "mdadm --monitor" - script "/usr/lib/systemd/scripts/mdadm_env.sh" does not exist. - I assume "mdadm_env.sh" should extract variables from "/etc/conf.d/mdadm" to file "/run/sysconfig/mdadm" - the consequence is: file "/run/sysconfig/mdadm" does not exist, too - these two non-existent files are non-fatal for the service because the "-" prefix - now the line "Environment=.." comes into play - therefore ExecStart=/sbin/mdadm --monitor $MDADM_MONITOR_ARGS expands to /sbin/mdadm --monitor --scan which terminates with the message "mdadm: No mail address or alert command - not monitoring." Solution: Add "--syslog" to arguments to make "mdadm --monitor" happy. And IMHO what the user expects. How? My choice would be to add "/usr/lib/systemd/scripts/mdadm_env.sh" to extract variables from "/etc/conf.d/mdadm" to file "/run/sysconfig/mdadm". Also: IMHO what the user (here: me) expects. Like on OpenRC systems. Reproducible: Always
1) nope mail address should be manually set in /etc/mdadm.conf (see on few last lines, before the ones of your arrays, that you've added on their initialisation). Also, as you can see, there is "-" sign before both `/run/sysconfig/mdadm` and `/usr/lib/systemd/scripts/mdadm_env.sh`. This means "it is ok to fail". And it fails exactly because you didn't set the email in mdadm.conf 2) although, I came here to report this exactly bug, but with another argumentation: a) `/run/sysconfig` looks like definitelly non-gentoo path. And looks like that systemd unit was copy-pasted from archlinux or so. b) well, it would be nice to either drop /usr/lib/systemd/scripts/mdadm_env.sh from the unit and make conf.d/mdadm the EnvironmentFile, or create that file during package installation and make it to do something useful.
Sadly this seems to be stuck here for years. I've just tried to enable the service file and got the following error: The unit files have no installation config (WantedBy=, RequiredBy=, Also=, Alias= settings in the [Install] section, and DefaultInstance= for template units). This means they are not meant to be enabled using systemctl. The other reported issues with /usr/lib/systemd/scripts/mdadm_env.sh are still in there as well.
(In reply to r7l from comment #2) > Sadly this seems to be stuck here for years. I've just tried to enable the > service file and got the following error: > > The unit files have no installation config (WantedBy=, RequiredBy=, Also=, > Alias= settings in the [Install] section, and DefaultInstance= for template > units). This means they are not meant to be enabled using systemctl. > > The other reported issues with /usr/lib/systemd/scripts/mdadm_env.sh are > still in there as well. I guess, "the right way" would be to use per-device `mdmon@` service :)