Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] mdadm: fix systemd service start up failure
@ 2019-06-20  3:14 changqing.li
  2019-06-20  7:35 ` Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: changqing.li @ 2019-06-20  3:14 UTC (permalink / raw)
  To: openembedded-core

From: Changqing Li <changqing.li@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@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@mydomain.tld/MAILADDR root@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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mdadm: fix systemd service start up failure
  2019-06-20  3:14 [PATCH] mdadm: fix systemd service start up failure changqing.li
@ 2019-06-20  7:35 ` Adrian Bunk
  2019-06-20  9:12   ` Changqing Li
  2019-06-24  8:08   ` [PATCH V2] " changqing.li
  0 siblings, 2 replies; 4+ messages in thread
From: Adrian Bunk @ 2019-06-20  7:35 UTC (permalink / raw)
  To: changqing.li; +Cc: openembedded-core

On Thu, Jun 20, 2019 at 11:14:03AM +0800, changqing.li@windriver.com wrote:
> From: Changqing Li <changqing.li@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.
>...
> +        sed -i -e 's/#MAILADDR root@mydomain.tld/MAILADDR root@mydomain.tld/g' ${D}${sysconfdir}/mdadm.conf
>...

Defaulting to try to send emails to an invalid address is worse than not 
having an email address configured.

Looking at the manpages I would have expected syslog-only monitoring to 
work if neither mailaddr nor program are configured.
If this isn't working, is this something upstream considers a bug?

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mdadm: fix systemd service start up failure
  2019-06-20  7:35 ` Adrian Bunk
@ 2019-06-20  9:12   ` Changqing Li
  2019-06-24  8:08   ` [PATCH V2] " changqing.li
  1 sibling, 0 replies; 4+ messages in thread
From: Changqing Li @ 2019-06-20  9:12 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: openembedded-core


On 6/20/19 3:35 PM, Adrian Bunk wrote:
> On Thu, Jun 20, 2019 at 11:14:03AM +0800, changqing.li@windriver.com wrote:
>> From: Changqing Li <changqing.li@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.
>> ...
>> +        sed -i -e 's/#MAILADDR root@mydomain.tld/MAILADDR root@mydomain.tld/g' ${D}${sysconfdir}/mdadm.conf
>> ...
> Defaulting to try to send emails to an invalid address is worse than not
> having an email address configured.
>
> Looking at the manpages I would have expected syslog-only monitoring to
> work if neither mailaddr nor program are configured.
> If this isn't working, is this something upstream considers a bug?
Thanks, I will check this, and try find another solution.
>
> cu
> Adrian
>
-- 
BRs

Sandy(Li Changqing)



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH V2] mdadm: fix systemd service start up failure
  2019-06-20  7:35 ` Adrian Bunk
  2019-06-20  9:12   ` Changqing Li
@ 2019-06-24  8:08   ` changqing.li
  1 sibling, 0 replies; 4+ messages in thread
From: changqing.li @ 2019-06-24  8:08 UTC (permalink / raw)
  To: openembedded-core

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

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

fixed by use option -y to cause all events to be reported
through 'syslog'.

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

fix by create dir before starting.

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

diff --git a/meta/recipes-extended/mdadm/files/mdmonitor.service b/meta/recipes-extended/mdadm/files/mdmonitor.service
index bd243b4..a81578e 100644
--- a/meta/recipes-extended/mdadm/files/mdmonitor.service
+++ b/meta/recipes-extended/mdadm/files/mdmonitor.service
@@ -13,7 +13,8 @@ ConditionPathExists=/etc/mdadm.conf
 Type=forking
 PIDFile=/var/run/mdadm/mdadm.pid
 EnvironmentFile=-/etc/sysconfig/mdmonitor
-ExecStart=/sbin/mdadm --monitor --scan -f --pid-file=/var/run/mdadm/mdadm.pid
+ExecStartPre=mkdir -p /var/run/mdadm
+ExecStart=/sbin/mdadm --monitor -y --scan -f --pid-file=/var/run/mdadm/mdadm.pid
 
 [Install]
 WantedBy=multi-user.target
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-06-24  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-20  3:14 [PATCH] mdadm: fix systemd service start up failure changqing.li
2019-06-20  7:35 ` Adrian Bunk
2019-06-20  9:12   ` Changqing Li
2019-06-24  8:08   ` [PATCH V2] " changqing.li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox