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:
[Timer]
OnCalendar=
OnCalendar=*-*-* 0,2,4,6,8,10,12,14,16,18,20,22:00
RandomizedDelaySec=15m
2. Next, we override the daily updates timer:
$ sudo systemctl edit apt-daily-upgrade.timer
[Timer]
OnCalendar=
OnCalendar=*-*-* 0,2,4,6,8,10,12,14,16,18,20,22:20
RandomizedDelaySec=1m
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.