getting systemd-status-mail to work
Hi, I'm trying to get the recently announced systemd-status-mail to work I'm using the following configuration: ---- # cat /etc/default/systemd-status-mail # ADDRESS is the mail account to which the status mails should be send ADDRESS=myaddress@gmx.de # Set HOSTNAME if the system does not set it or if you need to override # the system default #HOSTNAME=myhostname # Valid values for MAILER: "sendmail" or "mailx" MAILER="mailx -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" " # RELAYHOST specifies the mail relay used by mailx if specified RELAYHOST=smtp.gmx.net ---- So far so good, when it comes to send the mail (journalctl) Dez 11 00:04:45 systemd[1]: transactional-update.service: Triggering OnFailure= dependencies. Dez 11 00:04:45 systemd[1]: transactional-update.service: Consumed 22.964s CPU time. Dez 11 00:04:45 systemd[1]: Starting Send status mail for transactional-update.service... Dez 11 00:04:45 systemd[1]: systemd-status-mail@transactional-update.service.service: Deactivated successfully. Dez 11 00:04:45 systemd[1]: Finished Send status mail for transactional-update.service. That looks good, but no mail did arrive. Nothing in the journal, nor anything in /var/log that looks useful. Any idea how to nail that problem? Thanks Axel
On 11/12/2022 10:15, Axel Braun wrote:
Hi,
I'm trying to get the recently announced systemd-status-mail to work I'm using the following configuration:
---- # cat /etc/default/systemd-status-mail
# ADDRESS is the mail account to which the status mails should be send ADDRESS=myaddress@gmx.de
# Set HOSTNAME if the system does not set it or if you need to override # the system default #HOSTNAME=myhostname
# Valid values for MAILER: "sendmail" or "mailx" MAILER="mailx -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" "
# RELAYHOST specifies the mail relay used by mailx if specified RELAYHOST=smtp.gmx.net ---- So far so good, when it comes to send the mail (journalctl)
Dez 11 00:04:45 systemd[1]: transactional-update.service: Triggering OnFailure= dependencies. Dez 11 00:04:45 systemd[1]: transactional-update.service: Consumed 22.964s CPU time. Dez 11 00:04:45 systemd[1]: Starting Send status mail for transactional-update.service... Dez 11 00:04:45 systemd[1]: systemd-status-mail@transactional-update.service.service: Deactivated successfully. Dez 11 00:04:45 systemd[1]: Finished Send status mail for transactional-update.service.
That looks good, but no mail did arrive. Nothing in the journal, nor anything in /var/log that looks useful. Any idea how to nail that problem?
Thanks Axel
Try setting the binary option sendwait to the mailx command: MAILER="mailx -Ssendwait -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" " ^^^^^^^^^^
Ho, Am Sonntag, 11. Dezember 2022, 11:21:35 CET schrieb G McAlister:
Try setting the binary option sendwait to the mailx command:
MAILER="mailx -Ssendwait -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" " ^^^^^^^^^^
That gives now a sentence more: Dez 12 12:24:36 systemd[1]: transactional-update.service: Consumed 16.670s CPU time. Dez 12 12:24:36 systemd[1]: transactional-update.service: Triggering OnSuccess= dependencies. Dez 12 12:24:36 systemd[1]: Created slice Slice /system/systemd-status-mail. Dez 12 12:24:36 systemd[1]: systemd-status-mail@transactional-update.service.service: multiple trigger source candidates for exit status propagation (transactional-update.service, transactional-update.service), skipping. Dez 12 12:24:36 systemd[1]: Starting Send status mail for transactional-update.service... Dez 12 12:24:36 systemd[1]: systemd-status-mail@transactional-update.service.service: Deactivated successfully. Dez 12 12:24:36 systemd[1]: Finished Send status mail for transactional-update.service. ...but I have no idea what to do with his information. Not sure if it was due to manual trigger of the t-u.service, but should not Cheers Axel
On 12/12/2022 12:31, Axel Braun wrote:
Ho,
Am Sonntag, 11. Dezember 2022, 11:21:35 CET schrieb G McAlister:
Try setting the binary option sendwait to the mailx command:
MAILER="mailx -Ssendwait -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" " ^^^^^^^^^^ That gives now a sentence more:
Dez 12 12:24:36 systemd[1]: transactional-update.service: Consumed 16.670s CPU time. Dez 12 12:24:36 systemd[1]: transactional-update.service: Triggering OnSuccess= dependencies. Dez 12 12:24:36 systemd[1]: Created slice Slice /system/systemd-status-mail. Dez 12 12:24:36 systemd[1]: systemd-status-mail@transactional-update.service.service: multiple trigger source candidates for exit status propagation (transactional-update.service, transactional-update.service), skipping. Dez 12 12:24:36 systemd[1]: Starting Send status mail for transactional-update.service... Dez 12 12:24:36 systemd[1]: systemd-status-mail@transactional-update.service.service: Deactivated successfully. Dez 12 12:24:36 systemd[1]: Finished Send status mail for transactional-update.service.
...but I have no idea what to do with his information. Not sure if it was due to manual trigger of the t-u.service, but should not
Cheers Axel
Can you confirm that the /etc/default/systemd-status-mail configuration is actually being picked up in the systemd-status-mail unit? My experience with mailx and systemd has been that that systemd cleans up the service as soon as mailx has kicked off a sendmail request, killing the sendmail process before it completes - hence no mail. I solved this by setting the sendwait binary option to mailx, so thought it might be the same explanation here. The symptoms are the same.
Am Dienstag, 13. Dezember 2022, 11:10:59 CET schrieb G McAlister:
On 12/12/2022 12:31, Axel Braun wrote:
Ho,
Am Sonntag, 11. Dezember 2022, 11:21:35 CET schrieb G McAlister:
Try setting the binary option sendwait to the mailx command:
MAILER="mailx -Ssendwait -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" " ^^^^^^^^^^ That gives now a sentence more:
Dez 12 12:24:36 systemd[1]: transactional-update.service: Consumed 16.670s CPU time. Dez 12 12:24:36 systemd[1]: transactional-update.service: Triggering OnSuccess= dependencies. Dez 12 12:24:36 systemd[1]: Created slice Slice /system/systemd-status-mail. Dez 12 12:24:36 systemd[1]: systemd-status-mail@transactional-update.service.service: multiple trigger source candidates for exit status propagation (transactional-update.service, transactional-update.service), skipping. Dez 12 12:24:36 systemd[1]: Starting Send status mail for transactional-update.service... Dez 12 12:24:36 systemd[1]: systemd-status-mail@transactional-update.service.service: Deactivated successfully. Dez 12 12:24:36 systemd[1]: Finished Send status mail for transactional-update.service.
...but I have no idea what to do with his information. Not sure if it was due to manual trigger of the t-u.service, but should not
Cheers Axel
Can you confirm that the /etc/default/systemd-status-mail configuration is actually being picked up in the systemd-status-mail unit?
My best guess is 'yes', as it changed the error message after changing the configuration entry from mailx to mailx + command line parameters.
My experience with mailx and systemd has been that that systemd cleans up the service as soon as mailx has kicked off a sendmail request, killing the sendmail process before it completes - hence no mail. I solved this by setting the sendwait binary option to mailx, so thought it might be the same explanation here. The symptoms are the same.
Addting the sendwait changed the error to "multiple trigger source candidates for exit status propagation (transactional-update.service, transactional-update.service), skipping." so there is a change in behaviour. No idea how to tackle this, though. Will ask the author what he thinks... @carlos - I wanted to avoid to set-up a MTW on the Raspi as well.....but yes, that would be an alternative... Thanks Axel -- Dr.-Ing. Axel K. Braun M: +49.173.7003.154 T: @coogor Matrix/Elements: @docb:matrix.org PGP Fingerprint: 2E7F 3A19 A4A4 844A 3D09 7656 822D EB64 A3BA 290D Public Key available at http://www.axxite.com/axel.braun@gmx.de.asc Personal Freedom starts with free/libre Software ThinkPad X1 Extreme running openSUSE Tumbleweed 20221209
On 2022-12-11 11:15, Axel Braun wrote:
Hi,
I'm trying to get the recently announced systemd-status-mail to work I'm using the following configuration:
---- # cat /etc/default/systemd-status-mail
# ADDRESS is the mail account to which the status mails should be send ADDRESS=myaddress@gmx.de
# Set HOSTNAME if the system does not set it or if you need to override # the system default #HOSTNAME=myhostname
# Valid values for MAILER: "sendmail" or "mailx" MAILER="mailx -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" "
Maybe it only accepts "mailx" with no parameters. -- Cheers / Saludos, Carlos E. R. (from 15.4 x86_64 at Telcontar)
Am Montag, 12. Dezember 2022, 17:24:03 CET schrieb Carlos E. R.:
# Valid values for MAILER: "sendmail" or "mailx" MAILER="mailx -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" "
Maybe it only accepts "mailx" with no parameters.
No, that works even less......(tested already)
On 13/12/2022 09.48, Axel Braun wrote:
Am Montag, 12. Dezember 2022, 17:24:03 CET schrieb Carlos E. R.:
# Valid values for MAILER: "sendmail" or "mailx" MAILER="mailx -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" "
Maybe it only accepts "mailx" with no parameters.
No, that works even less......(tested already)
But maybe for a different reason. mailx needs configuration to know the mail server, login, password... In my case, I would use "sendmail", because I already have it configured. O rather, I would use mailx that would pass it over to sendmail. In your case, too much work. -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.4 (Legolas))
Hi, small update to the above topic: Am Montag, 12. Dezember 2022, 17:24:03 CET schrieb Carlos E. R.:
---- # cat /etc/default/systemd-status-mail
# ADDRESS is the mail account to which the status mails should be send ADDRESS=myaddress@gmx.de
# Set HOSTNAME if the system does not set it or if you need to override # the system default #HOSTNAME=myhostname
# Valid values for MAILER: "sendmail" or "mailx" MAILER="mailx -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" "
Maybe it only accepts "mailx" with no parameters.
Yes, and in between the systemd-status-mail was extended by the variable MAILX_OPTIONS which allow you to enter all the needed parameters. Small issue that still exists - if you set the -f parameter to specify the FROM address, this is currently not considered for the outgoing mail. So the sender is always root@myhostname. This fails with most service providers, as they check that the FROM address is from within their domain (like web.de etc). Cheers Axel
Am 10.01.23 um 17:42 schrieb Axel Braun:
Hi,
small update to the above topic:
Am Montag, 12. Dezember 2022, 17:24:03 CET schrieb Carlos E. R.:
---- # cat /etc/default/systemd-status-mail
# ADDRESS is the mail account to which the status mails should be send ADDRESS=myaddress@gmx.de
# Set HOSTNAME if the system does not set it or if you need to override # the system default #HOSTNAME=myhostname
# Valid values for MAILER: "sendmail" or "mailx" MAILER="mailx -Sverbose -Ssmtp-use-starttls -Ssmtp-auth=login -Ssmtp-auth-user="myaddress@gmx.de" -Ssmtp-auth-password="TopSecret" "
Maybe it only accepts "mailx" with no parameters.
Yes, and in between the systemd-status-mail was extended by the variable MAILX_OPTIONS which allow you to enter all the needed parameters.
Small issue that still exists - if you set the -f parameter to specify the FROM address, this is currently not considered for the outgoing mail. So the sender is always root@myhostname. This fails with most service providers, as they check that the FROM address is from within their domain (like web.de etc).
You mean "-r" ? Option "f" is something different. There is also the mailx env variable MAILRC to read options from.
Cheers Axel
Am Dienstag, 10. Januar 2023, 18:32:53 CET schrieb Manfred Schwarb:
Small issue that still exists - if you set the -f parameter to specify the FROM address, this is currently not considered for the outgoing mail. So the sender is always root@myhostname. This fails with most service providers, as they check that the FROM address is from within their domain (like web.de etc). You mean "-r" ? Option "f" is something different.
yes, typo...sorry Cheers Axel
Am Dienstag, 10. Januar 2023, 18:32:53 CET schrieb Manfred Schwarb:
Maybe it only accepts "mailx" with no parameters.
Yes, and in between the systemd-status-mail was extended by the variable MAILX_OPTIONS which allow you to enter all the needed parameters.
Small issue that still exists - if you set the -f parameter to specify the FROM address, this is currently not considered for the outgoing mail. So the sender is always root@myhostname. This fails with most service providers, as they check that the FROM address is from within their domain (like web.de etc).
You mean "-r" ?
Just FTR: I have openend https://bugzilla.opensuse.org/show_bug.cgi?id=1207059 for this
participants (5)
-
Axel Braun
-
Axel Braun
-
Carlos E. R.
-
G McAlister
-
Manfred Schwarb