brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: unattended-upgrades can mail you only when something goes wrong

Unattended-Upgrades
~/tips/tip-unattended-upgrades-mail-on-error

Unattended-Upgrade::Mail "[email protected]";

Hear about failed automatic updates without a daily message.

Automatic updates that fail silently are worse than no automatic updates, because you think you are covered. A mail setting fixes that.

In your local config file:

# /etc/apt/apt.conf.d/52unattended-upgrades-local
Unattended-Upgrade::Mail "[email protected]";
Unattended-Upgrade::MailReport "only-on-error";

MailReport takes always, only-on-error, on-change, on-new-change or on-upgrade. The default is on-change, which also keeps mailing while packages are held back. I would pick only-on-error for machines that should be boring, and on-upgrade if you like to know what changed.

The machine needs a way to send mail. The README asks for a mail transport agent such as postfix, or a mailx command. Test that part separately:

echo test | mailx -s "mail check" [email protected]

If that message never arrives, neither will the reports.

With error only mail, silence can also mean the job did not run or that mail broke last month. Check the logs in /var/log/unattended-upgrades/ once in a while, or send the test message again after changes to your mail setup.

Further reading: unattended-upgrades README, unattended-upgrades example config

More Unattended-Upgrades tips sudo nano /etc/apt/apt.conf.d/52unattended-upgrades-local apt-cache policy cat /etc/apt/apt.conf.d/20auto-upgrades sudo systemctl edit apt-daily-upgrade.timer Unattended-Upgrade::Automatic-Reboot "true"; All Unattended-Upgrades tips (7) All topics

Link