smartd sends mail before network is up on boot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
smartmontools (Ubuntu) |
Triaged
|
Wishlist
|
Unassigned |
Bug Description
lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04
apt-cache policy smartmontools
smartmontools:
Installed: 6.5+svn4324-1
Candidate: 6.5+svn4324-1
Version table:
*** 6.5+svn4324-1 500
500 http://
100 /var/lib/
Expected behavior:
smartd sends a test email on boot.
What happens:
No mail is recieved. sSMTP logs "Unable to locate Mail server" and "cannot open mailserver:25". I'm using the same smartd.conf and my script smartd calls that I used on 14.04, which worked flawlessly.
Work around:
I had my script sleep 5 seconds before sending the mail. This worked fine leading me to believe smartd is calling my script before networking is up. But this is not an elegant solution. So I copied /lib/systemd/
[Unit]
Description=Self Monitoring and Reporting Technology (SMART) Daemon
Documentation=
After=network-
[Service]
EnvironmentFile
ExecStart=
ExecReload=
StandardOutput=
[Install]
WantedBy=
I haven't got any other machines to test this on. So I hope the report will help some one else
Thanks for filing this bug in Ubuntu.
smartd won't always require networking, so making such a change distribution-wide is probably not the best solution. You adapted well to your local configuration settings, and I'm glad it worked.
Other MTAs probably would have handled this better I suspect, as ssmtp doesn't handle queueing.
Also note that -M test in smartd.conf is not about sending a test email on boot, but on restart of the smartd daemon. It can happen anytime, not just during boot. An upgrade of the package could trigger that, for example. In which case it would work, as network is already up.
It feels like a corner case, and I'm not sure there is an elegant solution that applies to all cases. Always depending on the network online target would increase boot times unnecessarily.