How do I get unattended-upgrades to email me every time it runs, even if there are no packages that need updating?
When there are upgrades they are applied and I am emailed, so the configuration is at least partially right.
System details and configuration
unattended-upgrades is running on my Raspberry Pi 3b, which is running stretch:
$ cat /etc/os-release | grep PRETTY
PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)
I installed unattended-upgrades
, ssmtp
, bsd-mailx
, apt-listchanges
.
Removing my email address, the un-commented content of 50unattended-upgrades
is:
Unattended-Upgrade::Origins-Pattern {
"o=Raspbian, a=stable";
"o=Raspberry Pi Foundation, a=stable";
};
Unattended-Upgrade::Package-Blacklist {
};
Unattended-Upgrade::MinimalSteps "true";
Unattended-Upgrade::Mail "xxx@xxx.com";
Unattended-Upgrade::MailOnlyOnError "false";
Unattended-Upgrade::Automatic-Reboot "true";
The content of 20auto-upgrades
is:
APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";
APT::Periodic::Verbose "1";
APT::Periodic::AutocleanInterval "7";
System behaviour
On June 10 unattended-upgrades ran, applied a number of upgrades and emailed me.
On June 11, unattended-upgrades ran, there were no upgrades or updates and I did not receive an email. Reviewing unattended-upgrades.log I see:
2019-06-10 06:13:06,708 INFO Initial blacklisted packages:
2019-06-10 06:13:06,710 INFO Initial whitelisted packages:
2019-06-10 06:13:06,711 INFO Starting unattended upgrades script
2019-06-10 06:13:06,712 INFO Allowed origins are: ['o=Raspbian, a=stable', 'o=Raspberry Pi Foundation, a=stable']
2019-06-10 06:14:48,222 INFO Packages that will be upgraded: ffmpeg libav-tools libavcodec57 libavdevice57 libavfilter6 libavformat57 libavresample3 libavutil55 libcupsfilters1 libpostproc54 libswresample2 libswscale4 omxplayer
2019-06-10 06:14:48,223 INFO Writing dpkg log to '/var/log/unattended-upgrades/unattended-upgrades-dpkg.log'
2019-06-10 06:24:41,720 INFO All upgrades installed
2019-06-10 06:24:55,243 INFO Packages that are auto removed: 'ffmpeg libav-tools libavdevice57 libsdl2-2.0-0'
2019-06-10 06:25:20,072 INFO Packages were successfully auto-removed
2019-06-11 06:45:06,671 INFO Initial blacklisted packages:
2019-06-11 06:45:06,674 INFO Initial whitelisted packages:
2019-06-11 06:45:06,675 INFO Starting unattended upgrades script
2019-06-11 06:45:06,676 INFO Allowed origins are: ['o=Raspbian, a=stable', 'o=Raspberry Pi Foundation, a=stable']
2019-06-11 06:45:24,801 INFO No packages found that can be upgraded unattended and no pending auto-removals
Additionally, reviewing the gmail account I use to send the unattended-upgrades email I see a sent email for the 10th of June but none for the 11th.
Additionally, I have just run
"Test email" | mail -s "Test Mail" xxx@xxx.com
And received this at the destination address.
Based on all of this I conclude that unattended-upgrades is not mailing me unless there are upgrades to apply. However I want an email each day, whether there are any upgrades or not. How can I get this?
(and yes, I could just set a cron job to mail me a tail of the log file, but I'd like to do it via unattended-upgrades and a confirmation "I ran but didn't need to do anything" seems like the kind of feature it would support)