You are not logged in.

#1 2015-02-28 18:04:48

dominicm
Member
Registered: 2015-01-03
Posts: 92

Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

I am using s-nail and have email configured but smartd seems to attempt to use /usr/bin/sendmail executable which does not exist. Smartmontools manual page clearly states it should use /usr/bin/mail as default executable. Why doesn't it do that on Arch Linux?

Smartd.conf manual: http://smartmontools.sourceforge.net/ma … onf.5.html
Search for "mail executable" to see the exact paragraph mentioning default executable.

By default, email is sent using the system mail command. In order that smartd find the mail command (normally /bin/mail) an executable named 'mail' must be in the path of the shell or environment from which smartd was started. If you wish to specify an explicit path to the mail executable (for example /usr/local/bin/mail) or a custom script to run, please use the '-M exec' Directive below.

I would like to avoid running a script when it should work out of the box.

Here's the log output of smartd:

journalctl -u smartd
Feb 28 16:54:14 localhost smartd[348]: Test of <mail> to sample@gmail.com produced unexpected output (67 b
Feb 28 16:54:14 localhost smartd[348]: /usr/bin/sendmail: No such file or directory
Feb 28 16:54:14 localhost smartd[348]: ... message not sent.

Last edited by dominicm (2015-10-05 11:13:31)

Offline

#2 2015-02-28 22:02:18

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

I told you in your previous thread (why not continue there?): mail (or mailx) uses sendmail. Please reread my answer there. For some reason you focused on the link, but the important bit was the quote from the man page.

Offline

#3 2015-02-28 22:17:11

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

Sorry, it was easy to miss the way the quote was worded. Though I don't think that applies to this anyway as I am no longer using SSMTP. In stead I am using s-nail only. In any case the mail program I am using is irrelevant to this question. It is the smartd (of smartmontools) that invokes the mail program and it should according to it's manual page invoke "mail" instead of "sendmail". I am actually able to send emails with a manual s-nail / mailx command. The issues is with smartd only.

Offline

#4 2015-02-28 22:19:49

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

Does it work if you create a symlink?

Offline

#5 2015-02-28 22:46:43

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

dominicm wrote:

Though I don't think that applies to this anyway as I am no longer using SSMTP. In stead I am using s-nail only.

So then you are using that smtp setting I quoted? Or is there a third way I overlooked?

In any case the mail program I am using is irrelevant to this question. It is the smartd (of smartmontools) that invokes the mail program and it should according to it's manual page invoke "mail" instead of "sendmail". I am actually able to send emails with a manual s-nail / mailx command. The issues is with smartd only.

Ah, okay, you didn't mention that before (well, you said "I have email configured" but after the other thread I wasn't really convinced I guess or simply confused about what setup you ended up with).

Rather than a symlink, I would try explicitly (re)setting the default value ("-M exec /usr/bin/mail") in smartd.conf (or remove any existing "-M exec /usr/bin/sendmail").

Last edited by Raynman (2015-02-28 22:49:08)

Offline

#6 2015-02-28 23:14:42

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

Log before the symlink:

Device: /dev/sdf [SAT], is in STANDBY mode, suspending checks
Feb 28 22:56:55 localhost smartd[9094]: Executing test of <mail> to sample@gmail.com ...
Feb 28 22:56:55 localhost smartd[9094]: Test of <mail> to sample@gmail.com produced unexpected output (67 bytes) to STDOUT/STDER
Feb 28 22:56:55 localhost smartd[9094]: /usr/bin/sendmail: No such file or directory
Feb 28 22:56:55 localhost smartd[9094]: ... message not sent.
Feb 28 22:56:55 localhost smartd[9094]: Test of <mail> to sample@gmail.com: successful

After symlink:

Device: /dev/sdf [SAT], is in STANDBY mode, suspending checks
Feb 28 22:59:49 localhost smartd[9459]: Executing test of <mail> to sample@gmail.com ...
Feb 28 22:59:49 localhost smartd[9459]: Test of <mail> to sample@gmail.com produced unexpected output (17 bytes) to STDOUT/STDER
Feb 28 22:59:49 localhost smartd[9459]: No mail for root
Feb 28 22:59:49 localhost smartd[9459]: Test of <mail> to sample@gmail.com: successful

It seems there may be more than one issue here but I have no clue what "No mail for root" could mean, any ideas?

Last edited by dominicm (2015-02-28 23:15:05)

Offline

#7 2015-02-28 23:33:01

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

@Raynman This whole email business is confusing smile Yes, it looks like I am using smtp as per your quote. "-M exec /usr/bin/mail" is a nice solution but I can't actually use the test parameter to try it out. I tried symlink which I assume is functionally the same with mixed results (see previous post).

Last edited by dominicm (2015-02-28 23:34:09)

Offline

#8 2015-03-02 12:22:24

sdaoden
Member
Registered: 2014-06-13
Posts: 30

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

Hello, i'm the maintainer of S-nail.

S-nail is a direct descendant of BSD Mail and thus represents the user-side of the traditional Unix mail system.
It thus requires the system-side, a local mail-transfer-agent (MTA), like sendmail or postfix, in order to deliver mail messages.
However, as Arch Linux compiles in the optional SMTP extension of S-nail it is also possible to configure SMTP and thus work directly with external (or local) SMTP servers, as is documented in [1].

  [1] https://wiki.archlinux.org/index.php/S- … MTP_server

P.S.: i hope S-nail will at someday also have a "minimum system-side" built in, but there are other things to do first.
For now i've updated the Arch Linux Wiki a bit to address this Forum topic.

Offline

#9 2015-03-02 19:06:28

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

sdaoden wrote:

Hello, i'm the maintainer of S-nail.

S-nail is a direct descendant of BSD Mail and thus represents the user-side of the traditional Unix mail system.
It thus requires the system-side, a local mail-transfer-agent (MTA), like sendmail or postfix, in order to deliver mail messages.
However, as Arch Linux compiles in the optional SMTP extension of S-nail it is also possible to configure SMTP and thus work directly with external (or local) SMTP servers, as is documented in [1].

  [1] https://wiki.archlinux.org/index.php/S- … MTP_server

P.S.: i hope S-nail will at someday also have a "minimum system-side" built in, but there are other things to do first.
For now i've updated the Arch Linux Wiki a bit to address this Forum topic.


Thanks for the reply and improving the wiki! One thing that confused me is the Quick Shot section being the first section which implies to me that it should work out of the box. I feel like Quick Shot section should be after any prerequisite sections like installing SMTP or configuring the internal SMTP extension of s-nail.

Can you atisfy my curiosity, why does s-nail use sendmail executable and not mail or other executable? Or is this just the default behavior on all platforms in s-nail? Seems like mail executable is far more common and seems like default for the optional SMTP extension.

Finally does the error in the previous post ("No mail for root") ring any bells? I am lost as to what it could mean...

Offline

#10 2015-03-02 20:50:24

sdaoden
Member
Registered: 2014-06-13
Posts: 30

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

Hmhm, i'm the maintainer..  Sorry for being so late, but i only occasionally look in Forums etc.

dominicm wrote:

Can you atisfy my curiosity, why does s-nail use sendmail executable and not mail or other executable?

Well, S-nail *is* Mail(1) a.k.a. POSIX mailx(1).  You can freely configure the system-side / backend by setting the *sendmail* variable.
It seems ArchLinux doesn't ship with any system-side by default, most likely because MTAs (sendmail(1), postfix(1)) are quite large program suites and people should be able to choose what they actually want without having the unused laying around, but i'm guessing here (sounds logical though).

Note that Arch Linux mail(1) (S-nail) is MIME capable and works with character sets beyond english.  Also it composes mail messages, whereas using sendmail(1) directly requires a pre-formatted message.  (That may be and presumably is enough for smartmontools but i don't know.)

dominicm wrote:

Finally does the error in the previous post ("No mail for root") ring any bells? I am lost as to what it could mean...

The message "No mail for USER" is printed when mailx(1) is not used in send- but receive-mode, the *emptystart* variable is not set and the system mailbox of USER is empty.
How this could happen in your configuration is a mystery to me smile

Offline

#11 2015-03-02 21:21:01

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

By settings sendmail variable do you mean symlink? You didn't actually say why sendmail is the default variable, I guess it's just not a very well thought out choice by the devs? Smartmontools should certainly work as is, I guess I will have to use a custom script where I can just issue a full mail command.

Regarding the No mail for root error, it seems that this error is produce when executing the command as non root user.

sudo echo "Sample Body" | mail -v -A gmail -s "Sample Subject" email@gmail.com

I get the same no mail for user error unless I become root with su command. It's still odd why presumably insufficient permissions would trigger s-nail to open in read mode. Another mystery is why smartd is not executing the mail command as root even though it is running as root...

Last edited by dominicm (2015-03-02 21:37:03)

Offline

#12 2015-03-02 22:19:16

sdaoden
Member
Registered: 2014-06-13
Posts: 30

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

dominicm wrote:

By settings sendmail variable do you mean symlink? You didn't actually say why sendmail is the default variable, I guess it's just not a very well thought out choice by the devs? Smartmontools should certainly work as is, I guess I will have to use a custom script where I can just issue a full mail command.

No, i mean the mailx(1) internal variable *sendmail*, to be set in ~/.mailrc or on the command line via -S, as in 'mail -Ssendmail=PROGRAM'.
When S-nail / mailx / Mail is compiled it tries to guess the path to the local mail-transfer-agent, with /usr/bin/sendmail being the last choice shall no executable been found in other places.
Maybe /usr/sbin/sendmail would be a better option on Arch Linux?

Anyway, you miss the system-side of the traditional Unix mail-system, the MTA, sendmail(1) or postfix(1) seem to be good options for an Arch Linux system.
Install one of those.
Then possibly adjust the *sendmail* variable to point to the actual executable, see the mail(1) manual shall that still not work (especially *sendmail* and *sendmail-progname*).
After that all should be fine.  (Don't forget to run newaliases(1) if your chosen MTA requires and ships that one, then.)

dominicm wrote:

sudo echo "Sample Body" | mail -v -A gmail -s "Sample Subject" email@gmail.com

Note that in this case sudo(1) applies to the echo(1) only, not to mail(1).
But i still wonder how that can result in that message.  I can't reproduce it.

Offline

#13 2015-03-02 22:38:30

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

I did use SSMTP which worked just fine, but then I realized I didn't need it so I went with s-nail only. It should work. Perhaps SSMTP left some configuration or change on the system that's causing the issue?

If /usr/bin/sendmail is the last choice why would it ever get chosen when it did not exist especially when mail and mailx variable existed? I don't know about /usr/bin/sendmail, I would think /usr/bin/mail is the safest first choice since it existed by default on my system (I think).

Problem with .mailrc is that there is no documentation. man mail shows only command line options, but does not mention options for .rcmail or syntax for it. Any resources you can link to?

I documented the steps I took so far for future reference and maybe for someone with mail troubles like me smile

Here's the link: http://dominicm.com/configure-email-not … rch-linux/

Do you see any possible cause of the sendmail exec compile choice or no mail rooot error?

Last edited by dominicm (2015-03-02 22:55:10)

Offline

#14 2015-03-06 09:35:51

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

@sdaoden can you tell me why the script examples and smart-runner are missing on Arch?

Offline

#15 2015-03-06 20:42:52

sdaoden
Member
Registered: 2014-06-13
Posts: 30

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

Nope.  You may be interested in [1] though.

  [1] http://comments.gmane.org/gmane.os.drag … .user/2934

Offline

#16 2015-03-06 21:23:12

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

sdaoden wrote:

Nope.  You may be interested in [1] though.

  [1] http://comments.gmane.org/gmane.os.drag … .user/2934

Is that the right article? It's somewhat interesting but it's about ssd's...

Bit more info in the error, does this give any new possible ideas?

With this added to the script the output is just "USER:" with not even a space where the actual username should be printed. I get the username printed when executed manually. When executed manually as after su command, however I still get the username of the pre su command username. Very odd.

echo "USER: "
echo "$USER"

Offline

#17 2015-10-05 11:12:18

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

I got it working in the end, here's a tutorial on how to Configure Email Notification on Arch Linux. in case someone else is having similar problems.

Offline

#18 2015-10-10 11:53:41

sdaoden
Member
Registered: 2014-06-13
Posts: 30

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

Hi Dominic.

I for one of course strongly advise against your tutorial since that uses the old configuration syntax and falsely claims that passwords must be stored in clear text.  The ArchLinux Wiki and the manual page prove you wrong.
Since that tutorial was on the first page of hits regarding S-nail for such a long time.  smile

Also note that there is not yet ANY OAUTH 2.0 for SASL, i occasionally see fly by the draft for this on the IETF announcement list.
S-nail doesn't support SASL, however.  But nonetheless, i do miss some context.

And then i hope that S-nail v14.9 (should i have named it S-mail or S-mailx from the start?  Now it is too late!) will ship some local delivery mode, i.e., implement very rudimentary MTA support.  But it is yet not existent.
Ciao.

Offline

#19 2015-10-10 12:34:10

dominicm
Member
Registered: 2015-01-03
Posts: 92

Re: Smartd / smartmontools use /usr/bin/sendmail not mail exec? [SOLVED]

I am not seeing any new configuration syntax in Arch Linux S-nail Wiki. If there is a better way of doing it please do tell. I am also not aware of another method of storing passwords but would like to know. The wiki mentions encrypted password vaguely but there is no example. Can you provide an example?

The article shows a working method, if there is a better way and it is documented in some form I will test it and edit the article. I also don't think it was ever in even the top 3 results for s-nail or arch s-nail search terms.

Offline

Board footer

Powered by FluxBB