Ubuntu seems to have an enduring blind-spot for security upgrades on computers which are not connected permanently to the internet. These days there are surely a ton of them, mostly laptops.
In theory the solution is unattended-upgrades
. On Ubuntu this runs by default with a daily systemd
timer or cron job. With cron, anacron
also runs by default as a protection, and executes any cron
jobs which were missed because the computer was turned off. So far so sensible.
BUT!
Default
unattended-upgrades
config (/etc/apt/apt.conf.d/50unattended-upgrades
or similar) requires the following to be set, else upgrades risk being skipped on a roaming laptop:Unattended-Upgrade::OnlyOnACPower "false"; Unattended-Upgrade::Skip-Updates-On-Metered-Connections "false";
Even worse,
anacron
, likecron
, runs jobs whether or not an internet connection is available! This is clearly a major design bug for non-server Ubuntu, since personal computers are not always connected permanently.
TLDR: With default config, on a roaming laptop, unattended-upgrades
will not work much of the time.
(Perhaps there needs to be a separate class of cron
job or systemd
timer-thing which waits for a network connection until executing. Or failed cron.daily
jobs could be switched to cron.hourly
until they execute successfully. Perhaps there is one already.)
One practical solution is a systemd
unit file to execute unattended-upgrades
as a user script after the network comes online. But it will only run once per boot.
What is the optimal solution? Does anyone know if there are plans to fix this with a new package or a config improvement?