Bug 1862739 - dnf-automatic command_email example will not work
Summary: dnf-automatic command_email example will not work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: amatej
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-08-02 00:51 UTC by Jason Montleon
Modified: 2021-01-11 01:49 UTC (History)
12 users (show)

Fixed In Version: dnf-4.4.2-1.fc33 dnf-4.4.2-1.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-29 01:25:47 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Jason Montleon 2020-08-02 00:51:56 UTC
Description of problem:
/etc/dnf/automatic.conf has a command_email command_format example as follows:
# command_format = "mail -s {subject} -r {email_from} {email_to}"

This will not ever work with systemd. All you'll see is ". . . message not sent" in the dnf-automatic service status and no email will be delivered. The reason for this is that mailx will fork, dnf-automatic will exit, and systemd will kill the mail process. 

Version-Release number of selected component (if applicable):
dnf-automatic-4.2.23-1.fc32.noarch

How reproducible:
Always. I helped someone debug this and for both of us it failed to send an email every single time. I added -v to mailx and suddenly it worked. What I learned is that -v prevents mailx from forking. To do this without verbose output you can use the `-Ssendwait` option.

Steps to Reproduce:
1. Install dnf-automatic
2. Configure it to use the command_email emitter
3. Enable dnf-automatic-install.timer


Actual results:
Email never comes. If you look at the dnf-automatic-install.service logs you'll see '... message not sent'

Expected results:
Email is delivered as expected.

Additional info:
The default command and example in automatic.conf should be
command_format = "mail -Ssendwait -s {subject} -r {email_from} {email_to}"

Comment 1 Jason Montleon 2020-08-02 00:55:17 UTC
Arch wiki describes this problem as well here: https://wiki.archlinux.org/index.php/Systemd/Timers#MAILTO

Comment 2 Jason Montleon 2020-08-02 14:06:33 UTC
PR: https://github.com/rpm-software-management/dnf/pull/1646

Comment 3 amatej 2020-08-04 08:52:37 UTC
The PR was merged, thanks again for the report and fix.

Comment 4 Fedora Update System 2020-11-27 15:45:45 UTC
FEDORA-2020-210ee4a384 has been submitted as an update to Fedora 33. https://bodhi.fedoraproject.org/updates/FEDORA-2020-210ee4a384

Comment 5 Fedora Update System 2020-11-27 15:47:26 UTC
FEDORA-2020-e49210967b has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e49210967b

Comment 6 Fedora Update System 2020-11-28 02:55:57 UTC
FEDORA-2020-210ee4a384 has been pushed to the Fedora 33 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-210ee4a384`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-210ee4a384

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 7 Fedora Update System 2020-11-28 03:04:31 UTC
FEDORA-2020-e49210967b has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-e49210967b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e49210967b

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2020-11-29 01:25:47 UTC
FEDORA-2020-210ee4a384 has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2021-01-11 01:49:57 UTC
FEDORA-2020-e49210967b has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.