You are not logged in.

#1 2014-06-20 02:15:19

dalu
Member
Registered: 2014-04-16
Posts: 79

mdadm: mdmonitor.service fails to start

because seems like openSuSE's service file was taken for mdadm-3.3.1-2

Failed at step EXEC spawning /usr/lib/systemd/scripts/mdadm_env.sh: No such file or directory

however you can't just take the rpm and extract because it needs some setting in /etc/sysconfig which afaik is not an arch directory

So I don't know, I thought I'd post here before opening an issue on the bugtracker.
Package isn't ready to upgrade.

Offline

#2 2014-06-20 18:56:24

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: mdadm: mdmonitor.service fails to start

According to the package manager, this is the service and it's in fact being used.

Maybe you have an old version somewhere?


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#3 2014-06-20 19:18:17

dalu
Member
Registered: 2014-04-16
Posts: 79

Re: mdadm: mdmonitor.service fails to start

systemctl --failed 
  UNIT              LOAD   ACTIVE SUB    DESCRIPTION
●mdmonitor.service loaded failed failed MD array monitor
systemctl status mdmonitor.service -l
● mdmonitor.service - MD array monitor
   Loaded: loaded (/usr/lib/systemd/system/mdmonitor.service; static)
   Active: failed (Result: exit-code) since Fri 2014-06-20 03:58:11 CEST; 17h ago
  Process: 288 ExecStart=/sbin/mdadm --monitor $MDADM_MONITOR_ARGS (code=exited, status=1/FAILURE)
  Process: 285 ExecStartPre=/usr/lib/systemd/scripts/mdadm_env.sh (code=exited, status=203/EXEC)
 Main PID: 288 (code=exited, status=1/FAILURE)

Jun 20 03:58:11 hostname systemd[1]: Starting MD array monitor...
Jun 20 03:58:11 hostname systemd[285]: Failed at step EXEC spawning /usr/lib/systemd/scripts/mdadm_env.sh: No such file or directory
Jun 20 03:58:11 hostname systemd[1]: Started MD array monitor.
Jun 20 03:58:11 hostname systemd[1]: mdmonitor.service: main process exited, code=exited, status=1/FAILURE
Jun 20 03:58:11 hostname systemd[1]: Unit mdmonitor.service entered failed state.
Jun 20 03:58:11 hostname mdadm[288]: mdadm: No mail address or alert command - not monitoring.

mdmonitor.service is part of mdadm-3.3.1-2

pacman -Ql mdadm 
mdadm /etc/
mdadm /etc/mdadm.conf
mdadm /usr/
mdadm /usr/bin/
mdadm /usr/bin/mdadm
mdadm /usr/bin/mdassemble
mdadm /usr/bin/mdmon
mdadm /usr/lib/
mdadm /usr/lib/initcpio/
mdadm /usr/lib/initcpio/hooks/
mdadm /usr/lib/initcpio/hooks/mdadm
mdadm /usr/lib/initcpio/install/
mdadm /usr/lib/initcpio/install/mdadm
mdadm /usr/lib/initcpio/install/mdadm_udev
mdadm /usr/lib/systemd/
mdadm /usr/lib/systemd/system-shutdown/
mdadm /usr/lib/systemd/system-shutdown/mdadm.shutdown
mdadm /usr/lib/systemd/system/
mdadm /usr/lib/systemd/system/mdadm-last-resort@.service
mdadm /usr/lib/systemd/system/mdadm-last-resort@.timer
mdadm /usr/lib/systemd/system/mdadm.service
mdadm /usr/lib/systemd/system/mdmon@.service
mdadm /usr/lib/systemd/system/mdmonitor.service
mdadm /usr/lib/udev/
mdadm /usr/lib/udev/rules.d/
mdadm /usr/lib/udev/rules.d/63-md-raid-arrays.rules
mdadm /usr/lib/udev/rules.d/64-md-raid-assembly.rules
mdadm /usr/share/
mdadm /usr/share/man/
mdadm /usr/share/man/man4/
mdadm /usr/share/man/man4/md.4.gz
mdadm /usr/share/man/man5/
mdadm /usr/share/man/man5/mdadm.conf.5.gz
mdadm /usr/share/man/man8/
mdadm /usr/share/man/man8/mdadm.8.gz
mdadm /usr/share/man/man8/mdmon.8.gz

Last edited by dalu (2014-06-20 19:21:10)

Offline

#4 2014-06-20 19:55:39

Rexilion
Member
Registered: 2013-12-23
Posts: 784

Re: mdadm: mdmonitor.service fails to start

Sorry about that. I misread.

It seems that this service file is provided by the package itself. I suggest you write a replacement in /etc/systemd/systemd/mdmonitor.service. Perhaps upload it to the Arch bugtracker?


fs/super.c : "Self-destruct in 5 seconds.  Have a nice day...\n",

Offline

#5 2014-07-07 08:54:09

strasharo
Member
Registered: 2014-07-07
Posts: 2

Re: mdadm: mdmonitor.service fails to start

Same here on a raspberry pi:

[root@pie ~]# systemctl --failed
  UNIT              LOAD   ACTIVE SUB    DESCRIPTION
*mdmonitor.service loaded failed failed MD array monitor

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.
[root@pie ~]# systemctl status mdmonitor.service -l
* mdmonitor.service - MD array monitor
   Loaded: loaded (/usr/lib/systemd/system/mdmonitor.service; static)
   Active: failed (Result: exit-code) since Thu 1970-01-01 02:01:27 EET; 44 years 6 months ago
Main PID: 269 (code=exited, status=1/FAILURE)

Jan 01 02:01:26 pie systemd[265]: Failed at step EXEC spawning /usr/lib/systemd/scripts/mdadm_env.sh: No such file or directory
Jan 01 02:01:27 pie mdadm[269]: mdadm: No mail address or alert command - not monitoring.
Jan 01 02:01:27 pie systemd[1]: Started MD array monitor.
Jan 01 02:01:27 pie systemd[1]: mdmonitor.service: main process exited, code=exited, status=1/FAILURE
Jan 01 02:01:27 pie systemd[1]: Unit mdmonitor.service entered failed state.
[root@pie ~]# pacman -Ql mdadm
mdadm /etc/
mdadm /etc/mdadm.conf
mdadm /usr/
mdadm /usr/bin/
mdadm /usr/bin/mdadm
mdadm /usr/bin/mdassemble
mdadm /usr/bin/mdmon
mdadm /usr/lib/
mdadm /usr/lib/initcpio/
mdadm /usr/lib/initcpio/hooks/
mdadm /usr/lib/initcpio/hooks/mdadm
mdadm /usr/lib/initcpio/install/
mdadm /usr/lib/initcpio/install/mdadm
mdadm /usr/lib/initcpio/install/mdadm_udev
mdadm /usr/lib/systemd/
mdadm /usr/lib/systemd/system-shutdown/
mdadm /usr/lib/systemd/system-shutdown/mdadm.shutdown
mdadm /usr/lib/systemd/system/
mdadm /usr/lib/systemd/system/mdadm-last-resort@.service
mdadm /usr/lib/systemd/system/mdadm-last-resort@.timer
mdadm /usr/lib/systemd/system/mdadm.service
mdadm /usr/lib/systemd/system/mdmon@.service
mdadm /usr/lib/systemd/system/mdmonitor.service
mdadm /usr/lib/udev/
mdadm /usr/lib/udev/rules.d/
mdadm /usr/lib/udev/rules.d/63-md-raid-arrays.rules
mdadm /usr/lib/udev/rules.d/64-md-raid-assembly.rules
mdadm /usr/share/
mdadm /usr/share/man/
mdadm /usr/share/man/man4/
mdadm /usr/share/man/man4/md.4.gz
mdadm /usr/share/man/man5/
mdadm /usr/share/man/man5/mdadm.conf.5.gz
mdadm /usr/share/man/man8/
mdadm /usr/share/man/man8/mdadm.8.gz
mdadm /usr/share/man/man8/mdmon.8.gz
[root@pie ~]# pacman -Qi mdadm
Name           : mdadm
Version        : 3.3.1-2
Description    : A tool for managing/monitoring Linux md device arrays, also known as Software RAID
Architecture   : armv6h
URL            : http://neil.brown.name/blog/mdadm
Licenses       : GPL
Groups         : base
Provides       : None
Depends On     : glibc
Optional Deps  : None
Required By    : None
Optional For   : None
Conflicts With : mkinitcpio<0.7
Replaces       : raidtools
Installed Size : 1130.00 KiB
Packager       : Arch Linux ARM Build System <builder+xu3@archlinuxarm.org>
Build Date     : Tue Jun 17 04:04:15 2014
Install Date   : Tue Jun 24 01:36:22 2014
Install Reason : Explicitly installed
Install Script : No
Validated By   : SHA256 Sum
[root@pie ~]#

Should I submit a new bug or dalu already did it? smile

Offline

#6 2014-07-16 21:26:24

eewallace
Member
Registered: 2013-06-26
Posts: 34

Re: mdadm: mdmonitor.service fails to start

In case either of you (dalu and stasharo) are still wondering about this, this thread on arch-general has some explanation of what's happening. The failure to find mdadm_env.sh is not a problem; mdmonitor.service is set up to allow that to fail without affecting the service. The failure of the service is due to trying to run mdadm --monitor without a valid email address. You need to configure one in your mdadm.conf in order for monitoring to work.

Offline

#7 2014-07-17 13:25:05

dalu
Member
Registered: 2014-04-16
Posts: 79

Re: mdadm: mdmonitor.service fails to start

strasharo wrote:

Same here on a raspberry pi:
Should I submit a new bug or dalu already did it? smile

I didn't find the time to do it, sorry.
The server's 2 SSDs are new and this wasn't a high priority problem for me.

eewallace: this is false.

Failed at step EXEC spawning /usr/lib/systemd/scripts/mdadm_env.sh: No such file or directory

even with MAILADDR root@localhost

Offline

#8 2014-07-17 14:26:10

eewallace
Member
Registered: 2013-06-26
Posts: 34

Re: mdadm: mdmonitor.service fails to start

dalu wrote:
strasharo wrote:

Same here on a raspberry pi:
Should I submit a new bug or dalu already did it? smile

I didn't find the time to do it, sorry.
The server's 2 SSDs are new and this wasn't a high priority problem for me.

eewallace: this is false.

Failed at step EXEC spawning /usr/lib/systemd/scripts/mdadm_env.sh: No such file or directory

even with MAILADDR root@localhost

But if you do

systemctl status mdmonitor

does the service still show as failed? On my desktop, I see

● mdmonitor.service - MD array monitor
   Loaded: loaded (/usr/lib/systemd/system/mdmonitor.service; static)
   Active: active (running) since Sat 2014-07-12 08:57:00 PDT; 4 days ago
  Process: 235 ExecStartPre=/usr/lib/systemd/scripts/mdadm_env.sh (code=exited, status=203/EXEC)
 Main PID: 238 (mdadm)
   CGroup: /system.slice/mdmonitor.service
           └─238 /sbin/mdadm --monitor --scan

The mdadm_env.sh script fails (as expected, because it doesn't exist), but the service ignores it and starts anyway. If you look at the service file, /usr/lib/systemd/system/mdmonitor.service:

#  This file is part of mdadm.
#
#  mdadm is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

[Unit]
Description=MD array monitor
DefaultDependencies=no

[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

You'll see that the ExecStartPre line is set with "=-" instead of "=", which indicates that it should try to execute that script, but that it's allowed to fail.

Offline

#9 2014-07-17 15:28:50

dalu
Member
Registered: 2014-04-16
Posts: 79

Re: mdadm: mdmonitor.service fails to start

Hmm I see, ok.

The files from opensuse should still be adopted/changed to work with arch without an errormsg.

/usr/lib/systemd/scripts/mdadm_env.sh

#!/bin/sh

# extract configuration from /etc/sysconfig/mdadm and write
# environment to /run/sysconfig/mdadm to be used by
# systemd unit files.

MDADM_SCAN="yes"

# Following adapted from /etc/init.d/mdadmd on openSUSE

mdadmd_CONFIG=/etc/sysconfig/mdadm
if test -r $mdadmd_CONFIG; then
   . $mdadmd_CONFIG
fi

if [ x$MDADM_DELAY != x"" ]; then
  MDADM_DELAY="-d "$MDADM_DELAY;
fi

if [ x$MDADM_MAIL != x"" ]; then
  MDADM_MAIL="-m \"$MDADM_MAIL\""
fi

if [ x$MDADM_PROGRAM != x"" ]; then
  MDADM_PROGRAM="-p \"$MDADM_PROGRAM\""
fi

if [ x$MDADM_SCAN = x"yes" ]; then
  MDADM_SCAN="--scan"
else
  MDADM_SCAN=""
fi

if [ x$MDADM_SEND_MAIL_ON_START = x"yes" ]; then
  MDADM_SEND_MAIL="-t"
else
  MDADM_SEND_MAIL=""
fi

if [ x$MDADM_CONFIG != x"" ]; then
  MDADM_CONFIG="-c \"$MDADM_CONFIG\""
fi

mkdir -p /run/sysconfig
echo "MDADM_MONITOR_ARGS=$MDADM_RAIDDEVICES $MDADM_DELAY $MDADM_MAIL $MDADM_PROGRAM $MDADM_SCAN $MDADM_SEND_MAIL $MDADM_CONFIG" > /run/sysconfig/mdadm

however the mdadm package on opensuse 13.1 doesn't have mdmonitor.service anymore or mdadm.service

they have mdmon@.service

#  This file is part of mdadm.
#
#  mdadm is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

[Unit]
Description=MD Metadata Monitor on /dev/%I
DefaultDependencies=no
Before=initrd-switch-root.target

[Service]
ExecStart=/sbin/mdmon --foreground %I
StandardInput=null
StandardOutput=null
StandardError=null
KillMode=none

Offline

#10 2014-07-17 18:50:02

eewallace
Member
Registered: 2013-06-26
Posts: 34

Re: mdadm: mdmonitor.service fails to start

The files from opensuse should still be adopted/changed to work with arch without an errormsg.

The service works just fine with Arch. A documentation change to make it more clear that monitoring is enabled automatically, but requires a configured email address to work, might be helpful, but I don't see it as worth the effort to make an Arch specific version of the package just to get rid of that line.

however the mdadm package on opensuse 13.1 doesn't have mdmonitor.service anymore or mdadm.service
they have mdmon@.service

The version of mdadm in the opensuse 13.1 repos is older than the one Arch uses, and mdmonitor.service was added in between. mdadm.service is an Arch-specific file that was added to provide systemd support before it was added upstream; it's redundant now that mdadm provides the same function, and there's a bug report suggesting it be removed.

Offline

#11 2014-07-17 19:30:56

dalu
Member
Registered: 2014-04-16
Posts: 79

Re: mdadm: mdmonitor.service fails to start

Right, opensuse's version is 3.3, arch's version is 3.3.1
I assumed is was the same because I've installed 13.1 just recently in a vm to try it.

Well, when I was doing contract work, if there were warnings, even if the warnings weren't fatal the contract issuer would not accept my work because of those warnings and demanded them being fixed.
So I have gotten used to treating warnings as errors. The contract issuer was right. The log entry imho can be seen as a warning.

There's a bug report, so the purpose of this thread has been fulfilled smile

/etc/sysconfig/mdadm

## Path:        System/File systems/Mdadm
## Description: Additional options for the mdadm daemon (see man mdadm(8)).
## Type:        integer
## Default:     60
## ServiceRestart:      mdadm
##
#
# A delay in seconds between polling the md arrays.
#
MDADM_DELAY=60

## Type:        string
## Default:     ""
#
# A mail address (or comma-separated list of mail addresses) to send alerts to.
#
MDADM_MAIL="root@localhost"

## Type:        string
## Default:     ""
#
# A program to be run whenever an event is detected.
#
MDADM_PROGRAM=""

## Type:        string
## Default:     ""
#
# Monitoring MD devices.
#
MDADM_RAIDDEVICES=""

## Type:        yesno
## Default:     yes
#
# "yes" for scanning config file or /proc/mdstat for missing information.
#
MDADM_SCAN=yes

## Type:        string
## Default:     "/etc/mdadm.conf"
#
# The config file.
#
MDADM_CONFIG="/etc/mdadm.conf"

## Type:        yesno
## Default:     no
#
# "yes" for email to be sent on start
#
MDADM_SEND_MAIL_ON_START=no

## Type:        integer
## Default:     60
#
# Timeout for udev device detection. This is the upper limit which the
# boot script will wait for udev to finish hotplug event processing.
# If not all devices are detected during boot this value should be
# increased. Setting this to '0' disables waiting for udev.
#
MDADM_DEVICE_TIMEOUT="60"

for future reference

Offline

#12 2014-07-17 20:12:08

eewallace
Member
Registered: 2013-06-26
Posts: 34

Re: mdadm: mdmonitor.service fails to start

The log entry imho can be seen as a warning.

I disagree. The intended functioning of the script is "try this, and if it doesn't work don't worry about it, just go ahead and do this other thing". The entry about not finding the file is just the script saying, "ok, I tried that and it didn't work, so now I'll go do that other thing", i.e., that it's working as intended. It can certainly be confusing when there's then an actual error, leading to looking in the wrong place for the fix, but if anything, that's a problem with systemd's reporting of failures of non-essential tasks, not with this service.

Anyway, I suspect that's just going to be something we disagree on, so I won't belabor the point further. I'd suggest marking the thread as solved if the service is in fact starting now, but it's your call.

Offline

#13 2014-08-07 17:37:53

t_mtzk
Member
Registered: 2014-08-07
Posts: 1

Re: mdadm: mdmonitor.service fails to start

How about this?

/etc/conf.d/mdadm

## Path:        System/File systems/Mdadm
## Description: Additional options for the mdadm daemon (see man mdadm(8)).
## Type:        integer
## Default:     60
## ServiceRestart:      mdadm
##
#
# A delay in seconds between polling the md arrays.
#
MDADM_DELAY=60

## Type:        string
## Default:     ""
#
# A mail address (or comma-separated list of mail addresses) to send alerts to.
#
MDADM_MAIL="root@localhost"

## Type:        string
## Default:     ""
#
# A program to be run whenever an event is detected.
#
MDADM_PROGRAM=""

## Type:        string
## Default:     ""
#
# Monitoring MD devices.
#
MDADM_RAIDDEVICES=""

## Type:        yesno
## Default:     yes
#
# "yes" for scanning config file or /proc/mdstat for missing information.
#
MDADM_SCAN="yes"

## Type:        string
## Default:     "/etc/mdadm.conf"
#
# The config file.
#
MDADM_CONFIG="/etc/mdadm.conf"

## Type:        yesno
## Default:     no
#
# "yes" for email to be sent on start
#
MDADM_SEND_MAIL_ON_START="no"

## Type:        integer
## Default:     60
#
# Timeout for udev device detection. This is the upper limit which the
# boot script will wait for udev to finish hotplug event processing.
# If not all devices are detected during boot this value should be
# increased. Setting this to '0' disables waiting for udev.
#
MDADM_DEVICE_TIMEOUT="60"

## Type:        yesno
## Default:     no
#
# "yes" for logging to syslog.
MDADM_SYSLOG="no"

/usr/lib/systemd/scripts/mdadm_env.sh

#!/bin/sh

# extract configuration from /etc/conf.d/mdadm and write
# environment to /run/mdadm/mdadm to be used by
# systemd unit files.

mdadmd_CONFIG=/etc/conf.d/mdadm
if test -r $mdadmd_CONFIG; then
   . $mdadmd_CONFIG
fi

if [ x$MDADM_DELAY != x"" ]; then
  MDADM_DELAY="--delay "$MDADM_DELAY;
fi

if [ x$MDADM_MAIL != x"" ]; then
  MDADM_MAIL="-m \"$MDADM_MAIL\""
fi

if [ x$MDADM_PROGRAM != x"" ]; then
  MDADM_PROGRAM="-p \"$MDADM_PROGRAM\""
fi

if [ x$MDADM_SCAN = x"yes" ]; then
  MDADM_SCAN="--scan"
else
  MDADM_SCAN=""
fi

if [ x$MDADM_SEND_MAIL_ON_START = x"yes" ]; then
  MDADM_SEND_MAIL="-t"
else
  MDADM_SEND_MAIL=""
fi

if [ x$MDADM_CONFIG != x"" ]; then
  MDADM_CONFIG="-c \"$MDADM_CONFIG\""
fi

if [ x$MDADM_SYSLOG = x"yes" ]; then
  MDADM_SYSLOG="--syslog"
else
  MDADM_SYSLOG=""
fi

mkdir -p /run/mdadm
echo "MDADM_MONITOR_ARGS=$MDADM_RAIDDEVICES $MDADM_DELAY $MDADM_MAIL $MDADM_PROGRAM $MDADM_SCAN $MDADM_SEND_MAIL $MDADM_CONFIG $MDADM_SYSLOG" > /run/mdadm/mdadm

/usr/lib/systemd/system/mdmonitor.service

#  This file is part of mdadm.
#
#  mdadm is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.

[Unit]
Description=MD array monitor
DefaultDependencies=no

[Service]
Environment=  MDADM_MONITOR_ARGS=--scan
EnvironmentFile=-/run/mdadm/mdadm
ExecStartPre=-/usr/lib/systemd/scripts/mdadm_env.sh
ExecStart=/sbin/mdadm --monitor $MDADM_MONITOR_ARGS

Offline

#14 2015-07-27 04:52:27

nachopro
Member
Registered: 2013-08-23
Posts: 78

Re: mdadm: mdmonitor.service fails to start

This problem stills in mdadm-3.3.2-2 sad

Offline

#15 2015-12-16 20:56:09

fettouhi
Member
Registered: 2007-05-07
Posts: 745

Re: mdadm: mdmonitor.service fails to start

I know this is an old thread but I am also still having issues with mdmonitor.service failing:

[af@andre ~]$ systemctl status mdmonitor.service -l
● mdmonitor.service - MD array monitor
   Loaded: loaded (/usr/lib/systemd/system/mdmonitor.service; static; vendor preset: disabled)
   Active: failed (Result: exit-code) since ons 2015-12-16 18:13:25 CET; 3h 39min ago
  Process: 601 ExecStart=/sbin/mdadm --monitor $MDADM_MONITOR_ARGS (code=exited, status=1/FAILURE)
  Process: 596 ExecStartPre=/usr/lib/systemd/scripts/mdadm_env.sh (code=exited, status=203/EXEC)
 Main PID: 601 (code=exited, status=1/FAILURE)

dec 16 18:13:25 andre systemd[1]: Starting MD array monitor...
dec 16 18:13:25 andre systemd[596]: mdmonitor.service: Failed at step EXEC spawning /usr/lib/systemd/scripts/mdadm_env.sh: No such file or directory
dec 16 18:13:25 andre systemd[1]: Started MD array monitor.
dec 16 18:13:25 andre mdadm[601]: mdadm: No mail address or alert command - not monitoring.
dec 16 18:13:25 andre systemd[1]: mdmonitor.service: Main process exited, code=exited, status=1/FAILURE
dec 16 18:13:25 andre systemd[1]: mdmonitor.service: Unit entered failed state.
dec 16 18:13:25 andre systemd[1]: mdmonitor.service: Failed with result 'exit-code'.

Offline

#16 2015-12-16 20:57:04

frostschutz
Member
Registered: 2013-11-15
Posts: 1,418

Re: mdadm: mdmonitor.service fails to start

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

Sounds like you don't have MAILADDR set in your mdadm.conf

Offline

Board footer

Powered by FluxBB