[Bug 1615482] Re: apt-daily timer runs at random hours of the day
Tony Garcia
1615482 at bugs.launchpad.net
Thu Apr 20 16:53:57 UTC 2017
I was able to override it using /etc/systemd/system/apt-
daily.timer.d/override.conf with this config:
###
[Timer]
OnCalendar=
OnCalendar=*-*-* 02:00
RandomizedDelaySec=4h
AccuracySec=1m
Persistent=true
###
Which Means:
OnCalendar | Any day *-*-* at 02:00hrs. NOTE: See the first empty OnCalendar, this was needed otherwise the time defined in here was added from the previous schedule instead of replaced. (https://github.com/systemd/systemd/issues/3233)
RandomizedDelaySec | Add a random delay of up to 4:00hrs [02:00-06:00]
AccuracySec | Start the process at any time within 1m of the calculated time (oncalendar + randomizeddleaysec) this results in [02:00-06:01]
---
Default is:
###
[Timer]
OnCalendar=*-*-* 6,18:00
RandomizedDelaySec=12h
AccuracySec=1h
###
Which means:
OnCalendar | Any day *-*-* at 06:00hrs and 18:00hrs
RandomizedDelaySec | Add a random delay of up to 12:00hrs [06:00-18:00, 18:00-06:00] (NOTE: at this point it could be any time!)
AccuracySec | Start the process at any time within 1h of the calculated time (oncalendar + randomizeddleaysec) this results in [06:00-19:00, 18:00-07:00]
---
Here I tested the overridden configuration:
# systemctl list-timers | grep -P "NEXT|apt"
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-04-21 05:46:11 CDT 17h left Thu 2017-04-20 11:42:55 CDT 3min 29s ago apt-daily.timer apt-daily.service
# systemctl restart apt-daily.timer && systemctl list-timers | grep -P "NEXT|apt"
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-04-21 02:58:14 CDT 15h left Thu 2017-04-20 11:42:55 CDT 3min 44s ago apt-daily.timer apt-daily.service
# systemctl restart apt-daily.timer && systemctl list-timers | grep -P "NEXT|apt"
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-04-21 04:05:12 CDT 16h left Thu 2017-04-20 11:42:55 CDT 3min 53s ago apt-daily.timer apt-daily.service
# systemctl restart apt-daily.timer && systemctl list-timers | grep -P "NEXT|apt"
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-04-21 05:44:41 CDT 17h left Thu 2017-04-20 11:42:55 CDT 4min 0s ago apt-daily.timer apt-daily.service
# systemctl restart apt-daily.timer && systemctl list-timers | grep -P "NEXT|apt"
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-04-21 03:05:18 CDT 15h left Thu 2017-04-20 11:42:55 CDT 4min 1s ago apt-daily.timer apt-daily.service
# systemctl restart apt-daily.timer && systemctl list-timers | grep -P "NEXT|apt"
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2017-04-21 03:48:18 CDT 16h left Thu 2017-04-20 11:42:55 CDT 4min 4s ago apt-daily.timer apt-daily.service
** Bug watch added: github.com/systemd/systemd/issues #3233
https://github.com/systemd/systemd/issues/3233
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to apt in Ubuntu.
https://bugs.launchpad.net/bugs/1615482
Title:
apt-daily timer runs at random hours of the day
Status in apt package in Ubuntu:
Triaged
Bug description:
apt, from 1.2.10 onwards (ie any version in Xenial, onwards) uses a
systemd timer instead of a cron.daily job. This is a good thing,
decoupling apt daily runs from the rest of cron, and ensuring other
cron.daily jobs are not blocked by up to half an hour by the default
settings of unattended-upgrades.
However the policy chosen is to have the apt daily script run at a
random hour of the day in a wrong headed attempt to reduce server
load. This has the side effect of running unattended-upgrades at
random hours of the day — such as business hours — rather than being
confined to between 6:25am and 6:55am, using the defaults.
A better policy would be to have the script activate at 6:00am plus an
interval of 20 minutes at one second intervals reducing the impact of
timezone population spikes, while still allowing unattended-upgrades
to run within a predictable interval, before 7am.
At the very least, some sort of note in the NEWS file detailing the
new behaviour would be welcome.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1615482/+subscriptions
More information about the foundations-bugs
mailing list