puppet-unattended_upgrades
puppet-unattended_upgrades copied to clipboard
random_sleep is ignored on machines using systemd
Hi!
It seems that on Debian machines running systemd (at least on Debian Buster), the random_sleep
parameter is ignored.
Indeed, apt transitioned from a cronjob to a systemd timer. /etc/cron.daily/apt-compat
now starts with:
# Systemd systems use a systemd timer unit which is preferable to
# run. We want to randomize the apt update and unattended-upgrade
# runs as much as possible to avoid hitting the mirrors all at the
# same time. The systemd time is better at this than the fixed
# cron.daily time
if [ -d /run/systemd/system ]; then
exit 0
fi
This means the cronjob exits if systemd is running. If that's the case, the machine uses /lib/systemd/system/apt-daily.timer
instead to manage automated updates. On Buster, this file looks like:
[Unit]
Description=Daily apt download activities
[Timer]
OnCalendar=*-*-* 6,18:00
RandomizedDelaySec=12h
Persistent=true
[Install]
WantedBy=timers.target
It also seems RandomizedDelaySec
is hard coded. I don't see a bug on apt for this issue, but I'll open one shortly.
To fix this issue, this module would need to modify the timer using the value passed to random_sleep
and reload systemd daemons.
Cheers,