Annoyed by daily status messages telling you about software updates? Change the systemd timer to update more often

If you also prefer to turn on all automatic updates on your Ubuntu servers (and if you haven’t, you should consider it!) then you might be mildly annoyed by the daily status messages that only tell you about software updates that have likely already happened.

I put up with them for years before it occurred to me that an easy solution is to increase the frequency that your system checks for updates.

If you’ve enabled and set up the unattended-upgrades package, you only need to make some minor modifications. Using this answer on stackexchange as a guide, I was able to set up checks every two hours. Assuming you’re running Ubuntu 18.04:

1. First, override the configuration of the daily timer.

$ sudo systemctl edit apt-daily.timer

This creates /etc/systemd/system/apt-daily.timer.d/override.conf. Fill it as follows:

OnCalendar=*-*-* 0,2,4,6,8,10,12,14,16,18,20,22:00

2. Next, we override the daily updates timer:

$ sudo systemctl edit apt-daily-upgrade.timer
OnCalendar=*-*-* 0,2,4,6,8,10,12,14,16,18,20,22:20

3. Change the file /etc/apt/apt.conf.d/20auto-upgrades to update every time the apt-daily-upgrade.timer runs by changing the “1” to “always”:

$ sudo vi /etc/apt/apt.conf.d/20auto-upgrades
APT::Periodic::Update-Package-Lists "always";
APT::Periodic::Unattended-Upgrade "always";
APT::Periodic::Download-Upgradeable-Packages "always";
APT::Periodic::AutocleanInterval "always";

You can confirm the new settings like so:

$ systemctl --all list-timers apt-daily{,-upgrade}.timer

NEXT                         LEFT       LAST                         PASSED       UNIT                    ACTIVATES
Wed 2021-09-01 08:05:54 EDT  35min left Wed 2021-09-01 06:10:28 EDT  1h 20min ago apt-daily.timer         apt-daily.service
Wed 2021-09-01 08:20:11 EDT  49min left Wed 2021-09-01 06:20:37 EDT  1h 9min ago  apt-daily-upgrade.timer apt-daily-upgrade.service

2 timers listed.

Please note that MiaB configures unattended-upgrades, so this change may/will be overwritten or conflict with some future MiaB upgrade.

Also, if you feel this improves MiaB functionality, please submit to the project GitHub (I haven’t read through your changes):

Interesting! How long has MiaB been configuring unattended-upgrades? I enabled it myself and after a brief googling I cannot find any documentation indicating it does that.

Many thanks! It looks like MiaB is configuring using the file /etc/apt/apt.conf.d/02periodic, which can successfully be overridden with /etc/apt/apt.conf.d/20auto-upgrades, so there should be no conflict. :slight_smile:

I’m surprised - I would have expected to see a tickbox confirming that auto-upgrades are enabled on the system status page, as well as the ability to disable notifications about software updates. In my experience, unattended-upgrades is rock-solid, set-it-and-forget-it levels of reliability.

I’m not clear you are aware that the status checks emails are generated by a python script that is separate from the above configurations, IIRC.

Also, MiaB only runs apt-get for updates (I don’t recall if this is configured by MiaB or unattended-updates), thus no notification of available updates could result in users not being aware they should log in and run updates that apt-get could not perform.

I am in fact aware of that! In fact, several updates back I went in and altered the script to get it to stop sending me the daily messages, which of course got overwritten on an update. The problem is that MiaB’s system status checker uses an 8-hour cache of apt's update data, which means that updates need to happen more than eight hours prior to the cache being generated to avoid getting the email.

This is a fair point, which is precisely why I’d expect it to be configurable as an option, not the default behavior. :slight_smile:

This would be nice, as it also generates semi-frequent support requests of varying types.

I think this may go against one of the goals of the project, which is to not have users presented with options that require some level of admin experience to understand. We get new users here that don’t know what nameservers are and get confused on how to configure a glue record, among other very basic admin-y questions (which we are happy to answer).

Again, totally reasonable. That was kind of what I was going for with this post: no modifications to MiaB itself alongside minor system updates. My solution won’t prevent every software update message from being generated, but I expect it will manage to eliminate most of them (and without reducing security or eliminating notifications, only by reducing nuisance notifications).

To get a definitive answer you’d have to look at the change logs, but IIRC it was at the time of the upgrade from Ubuntu 14.04 to Ubuntu 18.04.

I do not believe, but may be wrong on this, that Unattended Upgrades was available on Ubuntu 14.04.

This seems like a lot of effort for something that I don’t see as a big problem, the software update emails are not anywhere near daily (or at least not for me), and if they were bothering me then I would just filter them into a folder and check it every so often.

This topic was automatically closed 40 days after the last reply. New replies are no longer allowed.