5

I've been tearing my hair out trying to figure out why running unattended-upgrade wouldn't result in an email in my inbox, only for one to turn up this morning.

Is there a way to help debugging a new config by forcing unattended-upgrade to send an email whenever it runs?

I don't get any lines about email at all in /var/log/unattended-upgrades/unattended-upgrades.log

I'm running Debian 10.

4
  • 2
    Could you update your post to include the details from your /etc/apt/apt.conf.d/50unattended-upgrades file? Specifically the line referring to Unattended-Upgrade::Mail. Additionally what are you using to send the email? Is your smtp client/server setup properly? Thank you.
    – kemotep
    Commented May 8, 2020 at 12:17
  • To be clear: it is working, I recieved an email from the system when it did some updates this morning. The problem is I had no way to test if it was working while I had a fully patched system. That config line is Unattended-Upgrade::Mail "[email protected]";. I'm using exim4 and it's working fine - I can send emails from the shell as myself or root using mail or mailx.
    – sandyscott
    Commented May 8, 2020 at 17:07
  • I defined unattended-upgrade configuration in /etc/apt/apt.conf.d/50unattended-upgrades file. I receive an email with this subject: unattended-upgrades result for debian.example.com: SUCCESS. Where does that debian.example.com comes from? How could I add my VPS name instead? (I am using Exim4, and /etc/email-addresses is empty, is this related?) Commented Jan 9, 2022 at 14:57
  • @user1185081 You might have more luck posting that as a separate question. I haven't dug any deeper into this since I got it working.
    – sandyscott
    Commented Jan 11, 2022 at 12:48

1 Answer 1

2

It will send an email if you uncomment this line and set it to "always". You dont have to use these sed commands, you can just edit the file. I'm just sharing them because I use several VMs:

sed -i 's,//Unattended-Upgrade::MailReport "on-change";,Unattended-Upgrade::MailReport "always";,' /etc/apt/apt.conf.d/50unattended-upgrades

Then set it only on error:

sed -i 's,Unattended-Upgrade::MailReport "always";,Unattended-Upgrade::MailReport "only-on-error";,' /etc/apt/apt.conf.d/50unattended-upgrades

Or to set it first to only on error:

sed -i 's,//Unattended-Upgrade::MailReport "on-change";,Unattended-Upgrade::MailReport "only-on-error";,' /etc/apt/apt.conf.d/50unattended-upgrades

Then run it manually with unattended-upgrades and it will send a "SUCCESS" email even if there are no updates to upgrade.

1
  • 2
    Thanks! Tested and works exactly as expected. It's great to get a resolution to a 3 year old question.
    – sandyscott
    Commented Jan 16, 2023 at 20:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .