1

I have a strange error that I cannot figure out myself. I want unattended upgrades to send a status e-mail to a certain address. But somehow it always changes the "to" field in that email to something else. No matter what I configure.

/etc/apt/apt.conf.d/50unattended-upgrades:

    Unattended-Upgrade::Allowed-Origins {
      "${distro_id}:${distro_codename}-security";
};

Unattended-Upgrade::Package-Blacklist {
};

Unattended-Upgrade::AutoFixInterruptedDpkg "true";
Unattended-Upgrade::Mail "myname@mydomain.com";
Unattended-Upgrade::MailReport "always";

When I check the postfix mail log (setup as a smart relay) it shows the following output.

/var/log/mail.log:

Jul  4 12:49:06 T3CPSRPI01 postfix/local[32055]: 360533F9BA: to=<root@hostname.mydomain.com>, orig_to=<root>, relay=local, delay=0.09, delays=0.05/0/0/0.04, dsn=2.0.0, status=sent (delivered to command: procmail -a "$EXTENSION")

I have no idea why it tries to send a status email to root@hostname.mydomain.com instead of myname@mydomain.com. I use the same configuration (postfix, unattended-upgrades) on all my debian machines and it works flawlessly. Only on this raspberry pi it doesnt work.

The sendmail command works without problems:

echo "Subject: sendmail test" | sendmail -v myname@mydomain.com

Do you have any ideas?

xronin
  • 11
  • 1
  • Your could reduce the search space [attaching](https://serverfault.com/posts/1135656/edit) relevant output of calling `unattended-upgrade --debug` (The last lines should include `Sending mail to root` and its exit code, confirming what is passed to `sendmail` or `mailx`) – anx Jul 08 '23 at 20:19
  • The debug output doesn't say anything about a send mail. But I checked the `/var/mail/` folder. It seems like all mails of unattended-upgrades are stored in a file called `nobody` – xronin Jul 09 '23 at 10:16
  • I still don't understand why all e-mails are delivered locally. – xronin Jul 09 '23 at 10:17

1 Answers1

0

If its sending to orig_to=<root> then your apt configuration may not be effective. Disregard the expansion to hostname, that after-effect is otherwise rather reasonable for incomplete recipients.

Prove it by calling apt-config dump Unattended-Upgrade::Mail - you expect that to print Unattended-Upgrade::Mail "myname@mydomain.com"; based on what is in the file you looked into, but it might be overridden in another file.

anx
  • 8,963
  • 5
  • 24
  • 48
  • Thanks for your reply. I executed your command `apt-config dump Unattended-Upgrade::Mail` and the result is exactly the e-mail adress where I want to send the status mail to: `myname@mydomain.com`. – xronin Jul 08 '23 at 13:19