[systemd-devel] systemd and smartd daemon

Andrei Borzenkov arvidjaar at gmail.com
Thu Apr 2 10:57:50 PDT 2015


В Thu, 2 Apr 2015 10:43:00 -0700
Al Lau <lauatic at gmail.com> пишет:

> Hi,
> 
> I am seeking help and advise on troubleshooting the starting of the smartd
> daemon.  The /usr/sbin/smartd comes from the smartmontools version 6.3.
> 
> The /usr/lib/systemd/system/smartd.service file looks like this
> 
> # cat /usr/lib/systemd/system/smartd.service
> [Unit]
> Description=Self Monitoring and Reporting Technology (SMART) Daemon
> Documentation=man:smartd(8) man:smartd.conf(5)
> After=syslog.target
> 
> [Service]
> Type=forking
> PIDFile=/run/smartd.pid
> ExecStartPre=/bin/rm -f /run/smartd.pid
> EnvironmentFile=/etc/sysconfig/smartmontools
> ExecStart=/usr/sbin/smartd $smartd_opts
> ExecReload=/bin/kill -HUP $MAINPID
> StandardOutput=syslog
> 
> [Install]
> WantedBy=multi-user.target
> 
> When "systemctl start smartd.service" is called, the process forks into a
> daemon.  The problem I'm seeing is that the forked process received a
> SIGTERM signal and exited.  How do I resolve this so that the forked
> process would not get terminated.
> 
> # systemctl status smartd.service
> smartd.service - Self Monitoring and Reporting Technology (SMART) Daemon
>    Loaded: loaded (/usr/lib/systemd/system/smartd.service; enabled)
>    Active: failed (Result: timeout) since Thu 2015-04-02 17:19:49 GMT; 4min
> 39s ago
>      Docs: man:smartd(8)
>            man:smartd.conf(5)
>   Process: 7456 ExecStart=/usr/sbin/smartd $smartd_opts (code=exited,
> status=0/SUCCESS)
>   Process: 7454 ExecStartPre=/bin/rm -f /run/smartd.pid (code=exited,
> status=0/SUCCESS)
>  Main PID: 1075 (code=exited, status=0/SUCCESS)
> 
> Apr 02 17:18:20 007 smartd[7456]: Device: /dev/bus/0 [megaraid_disk_19],
> opened
> Apr 02 17:18:20 007 smartd[7456]: Device: /dev/bus/0 [megaraid_disk_19],
> [TOSHIBA  MG03SCA300       5702], lu ....00 TB
> Apr 02 17:18:20 007 smartd[7456]: Device: /dev/bus/0 [megaraid_disk_19], is
> SMART capable. Adding to "monitor" list.
> Apr 02 17:18:20 007 smartd[7456]: Monitoring 0 ATA and 12 SCSI devices
> Apr 02 17:18:21 007 systemd[1]: PID file /run/smartd.pid not readable
> (yet?) after start.
> Apr 02 17:18:21 007 smartd[7463]: smartd has fork()ed into background mode.
> New PID=7463.
> Apr 02 17:19:49 007 systemd[1]: smartd.service operation timed out.
> Terminating.

There are to possibilities

- smartd main process does not exit after fork. Check with systemd-cgls
  immediately after systemctl start.
- PID file is not created with path systemd expects

> Apr 02 17:19:49 007 smartd[7463]: smartd received signal 15: Terminated
> Apr 02 17:19:49 007 systemd[1]: Failed to start Self Monitoring and
> Reporting Technology (SMART) Daemon.
> Apr 02 17:19:49 007 systemd[1]: Unit smartd.service entered failed state.
> Hint: Some lines were ellipsized, use -l to show in full.
> #
> 
> To verify, I take the "/usr/sbin/smartd $smartd_opts" and run it from the
> command line.  The smartd daemon forks and the daemon process stays up as
> expected.
> 
> Thanks,
> -Al



More information about the systemd-devel mailing list