1

EDIT: There doesn't seem to be anything wrong. The reason that the test email wasn't sent out was likely due to that the computer had not established an internet connection as the service tried to send it. But when I manually restarted the service, the computer had fully established the internet connection and the email was sent successfully. So, no error. Thanks anyway!

I've just found out about Smartmontools and decided I'd try it. I've set it up using this guide: https://pve.proxmox.com/wiki/Disk_Health_Email_Alerts

I removed the comment for start_smartd=yes to "start smartd on system startup" and also the smartd_opts one to edit the interval in the "/etc/default/smartmontools" file.

In the smartd config file ("/etc/smartd.conf"), I made a devicescan: DEVICESCAN -m my@email.com -M test and saved it. When I manually stop the service with sudo /etc/init.d/smartmontools stop and then manually start it again, I get an email instantly. But if I reboot the computer, nothing happens.

If I run systemctl status after manually restarting the smartd service or after rebooting the computer, everything seems to be pretty much identical on the smartd service. (except for the number in "smartd.service->968 /usr/sbin/smartd -n --interval=10800" which I'm assuming is what ID was assigned to the service when it started and shouldn't really matter to this issue?

How can I make the smartd service work after a reboot without manually restarting the service?

I'm still quite new to Linux so I might need a rather detailed answer if the solution is complicated. Thanks!

EDIT: As requested, insserv -s | grep smart gives the result

K:01:1:smartmontools

S:02:2 3 4 5:smartmontools

And systemctl is-enabled smartd says "enabled"

Also, I realized that I hadn't mentioned it but I'm running Debian.

Second EDIT: After running journalctl -b -u smartd I noticed the error that is likely causing it. It seems SSMTP is unable to connect to the SMTP server from Google at reboot, not sure why though. But when I manually restart the service, it does work. I'm thinking that the computer hasn't established an internet connection as the service tries to send the test mail, could that be right? Is there any method of fixing this or alternatively have the test email be sent after a minute or so?

LOG: After the reboot, the log looked like this (email part, the actual DEVICESCAN seems to be working)

Dec 26 14:43:50 debian smartd[523]: Monitoring 1 ATA and 0 SCSI devices

Dec 26 14:43:50 debian smartd[523]: Executing test of to email@email.com ...

Dec 26 14:43:50 debian sSMTP[570]: Unable to locate smtp.gmail.com

Dec 26 14:43:50 debian sSMTP[570]: Cannot open smtp.gmail.com:587

Dec 26 14:43:50 debian smartd[523]: Test of to email@email.com produced unexpected output (101 bytes) to STDOUT/STDERR:

Dec 26 14:43:50 debian smartd[523]: send-mail: Cannot open smtp.gmail.com:587

Dec 26 14:43:50 debian smartd[523]: Can't send mail: sendmail process failed with error code 1

Dec 26 14:43:50 debian smartd[523]: Test of to email@email.com: successful

Dec 26 14:43:50 debian smartd[523]: Device: /dev/sda [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 73 to 71

Dec 26 14:43:50 debian smartd[523]: Device: /dev/sda [SAT], state written to /var/lib/smartmontools/smartd.Samsung_SSD_850_EVO_250GB-.ata.state

After manually restarting, the log looks the same except for the email part that is actually working:

Dec 26 14:48:00 debian smartd[881]: Monitoring 1 ATA and 0 SCSI devices

Dec 26 14:48:00 debian smartd[881]: Executing test of to email@email.com ...

Dec 26 14:48:00 debian sSMTP[912]: Creating SSL connection to host

Dec 26 14:48:00 debian sSMTP[912]: SSL connection using RSA_AES_128_CBC_SHA1

Dec 26 14:48:02 debian sSMTP[912]: Sent mail for root@debian.test.com (221 2.0.0 closing connection h42sm10593373lfi.30 - gsmtp) uid=0 username=root outbytes=893

Dec 26 14:48:02 debian smartd[881]: Test of to email@email.com: successful

Dec 26 14:48:02 debian smartd[881]: Device: /dev/sda [SAT], state written to /var/lib/smartmontools/smartd.Samsung_SSD_850_EVO_250GB-.ata.state

  • what says insserv -s | grep smart and systemctl is-enabled smartd. Please edit you question for answer. – user192526 Dec 25 '16 at 23:31
  • You can show for errors with journalctl -b -u smartd – user192526 Dec 26 '16 at 10:26
  • @Bahamut Thank you, the error seems to show that SSMTP isn't working properly. Do you have any ideas as to why this happens? Could it be that the computer, after a restart, hasn't been able to establish an internet connection before SSMTP tries to send the test email? – L.Johnson Dec 26 '16 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.