Bug#850180: mdadm: systemd units do not obey /etc/default/mdadm, esp DAEMON_OPTIONS=--syslog

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug#850180: mdadm: systemd units do not obey /etc/default/mdadm, esp DAEMON_OPTIONS=--syslog

Matthew Gabeler-Lee-2
Package: mdadm
Version: 3.4-4
Severity: normal

I had some recent array events, notified by email (worked), and was trying
to look up when the recovery finished in syslog, only to discover that the
mdadm array monitor is not logging to syslog.  This seems to be because the
systemd unit and/or initramfs support (not sure which) that started the
monitor daemon does not obey (or even look at?) /etc/default/mdadm, where I
have:

DAEMON_OPTIONS="--syslog"

I think this is even the default.

Whereas mdmonitor.service has only:

####
[Unit]
Description=MD array monitor
DefaultDependencies=no

[Service]
ExecStart=/sbin/mdadm --monitor --scan
####


-- Package-specific info:
--- mdadm.conf
CREATE owner=root group=disk mode=0660 auto=yes
HOMEHOST cheetah.fastcat.org
MAILADDR root
ARRAY <snipped>

--- /etc/default/mdadm
AUTOCHECK=true
START_DAEMON=true
DAEMON_OPTIONS="--syslog"
VERBOSE=false

Auto-generated on Wed, 04 Jan 2017 13:31:06 -0500 by mdadm bugscript

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-2-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mdadm depends on:
ii  debconf [debconf-2.0]  1.5.59
ii  libc6                  2.24-8
ii  lsb-base               9.20161125
ii  udev                   232-8

Versions of packages mdadm recommends:
ii  exim4-daemon-light [mail-transport-agent]  4.88~RC6-2
ii  kmod                                       23-1

mdadm suggests no packages.

-- Configuration Files:
/etc/cron.daily/mdadm changed [not included]

-- debconf information:
  mdadm/initrdstart_notinconf: false
* mdadm/start_daemon: true
* mdadm/mail_to: root
  mdadm/initrdstart_msg_errexist:
* mdadm/autocheck: true
* mdadm/autostart: true
  mdadm/initrdstart_msg_errconf:
  mdadm/initrdstart_msg_errmd:
* mdadm/warning:
* mdadm/initrdstart: all
  mdadm/initrdstart_msg_intro:
  mdadm/initrdstart_msg_errblock:

Reply | Threaded
Open this post in threaded view
|

Bug#850180: mdadm: systemd units do not obey /etc/default/mdadm, esp DAEMON_OPTIONS=--syslog

Matthew Gabeler-Lee-2
Package: mdadm
Version: 3.4-4+b1
Followup-For: Bug #850180

The DAEMON_OPTIONS bit of this is trivially corrected with this patch:

--- mdmonitor.service.orig      2017-09-26 00:54:25.491632797 -0400
+++ /lib/systemd/system/mdmonitor.service       2017-09-26 00:54:29.047611746 -0400
@@ -10,4 +10,5 @@
 DefaultDependencies=no
 
 [Service]
-ExecStart=/sbin/mdadm --monitor --scan
+EnvironmentFile=-/etc/default/mdadm
+ExecStart=/sbin/mdadm --monitor --scan $DAEMON_OPTIONS


-- System Information:
Debian Release: 9.1
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'testing'), (500, 'oldstable'), (490, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.9.0-3-amd64 (SMP w/12 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages mdadm depends on:
ii  debconf [debconf-2.0]  1.5.61
ii  libc6                  2.24-11+deb9u1
ii  lsb-base               9.20161125
ii  udev                   232-25+deb9u1

Versions of packages mdadm recommends:
ii  exim4-daemon-light [mail-transport-agent]  4.89-2+deb9u1
ii  kmod                                       23-2

mdadm suggests no packages.

-- Configuration Files:
/etc/cron.daily/mdadm changed [not included]

-- debconf information excluded

Reply | Threaded
Open this post in threaded view
|

Bug#850180: mdadm: systemd units do not obey /etc/default/mdadm, esp DAEMON_OPTIONS=--syslog

Michael Biebl-3
In reply to this post by Matthew Gabeler-Lee-2
On Wed, 04 Jan 2017 13:42:42 -0500 Matthew Gabeler-Lee
<[hidden email]> wrote:

> Package: mdadm
> Version: 3.4-4
> Severity: normal
>
> I had some recent array events, notified by email (worked), and was trying
> to look up when the recovery finished in syslog, only to discover that the
> mdadm array monitor is not logging to syslog.  This seems to be because the
> systemd unit and/or initramfs support (not sure which) that started the
> monitor daemon does not obey (or even look at?) /etc/default/mdadm, where I
> have:
>
> DAEMON_OPTIONS="--syslog"
The canonical way to override the behaviour of systemd units is via
drop-in config snippets. The usage of EnvironmentFile= is discouraged.

/etc/default/$pkg is a kludge which was introduced to make SysV init
scripts extensible.

That said, it would probably be a good idea to add a comment to
/etc/default/mdadm, that this file is only used by the SysV init script,
to avoid confusion.

Michael

--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?


signature.asc (849 bytes) Download Attachment