[OE-core] [PATCH] mdadm: fix systemd service start up failure

changqing.li at windriver.com changqing.li at windriver.com
Thu Jun 20 03:14:03 UTC 2019


From: Changqing Li <changqing.li at windriver.com>

1. mdadm: No mail address or alert command - not monitoring

with --monitor mode, mdadm needs a mail address and/or a program.
This can be given with "mailaddr" and "program" lines to that
monitoring can be started using.

fix by given a mail address, user can replace with a valid one
when use.

2. cannot create pid file: No such file or directory

fix by create dir before starting.

Signed-off-by: Changqing Li <changqing.li at windriver.com>
---
 meta/recipes-extended/mdadm/files/mdmonitor.service | 1 +
 meta/recipes-extended/mdadm/mdadm_4.1.bb            | 1 +
 2 files changed, 2 insertions(+)

diff --git a/meta/recipes-extended/mdadm/files/mdmonitor.service b/meta/recipes-extended/mdadm/files/mdmonitor.service
index bd243b4..a1b693f 100644
--- a/meta/recipes-extended/mdadm/files/mdmonitor.service
+++ b/meta/recipes-extended/mdadm/files/mdmonitor.service
@@ -13,6 +13,7 @@ ConditionPathExists=/etc/mdadm.conf
 Type=forking
 PIDFile=/var/run/mdadm/mdadm.pid
 EnvironmentFile=-/etc/sysconfig/mdmonitor
+ExecStartPre=mkdir -p /var/run/mdadm
 ExecStart=/sbin/mdadm --monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid
 
 [Install]
diff --git a/meta/recipes-extended/mdadm/mdadm_4.1.bb b/meta/recipes-extended/mdadm/mdadm_4.1.bb
index 494b81b..aa1fdb3 100644
--- a/meta/recipes-extended/mdadm/mdadm_4.1.bb
+++ b/meta/recipes-extended/mdadm/mdadm_4.1.bb
@@ -57,6 +57,7 @@ do_install() {
 do_install_append() {
         install -d ${D}/${sysconfdir}/
         install -m 644 ${S}/mdadm.conf-example ${D}${sysconfdir}/mdadm.conf
+        sed -i -e 's/#MAILADDR root at mydomain.tld/MAILADDR root at mydomain.tld/g' ${D}${sysconfdir}/mdadm.conf
         install -d ${D}/${sysconfdir}/init.d
         install -m 755 ${WORKDIR}/mdadm.init ${D}${sysconfdir}/init.d/mdmonitor
 }
-- 
2.7.4



More information about the Openembedded-core mailing list