My attempt to restrict unattended reboots to times between 0 and 6 AM wasn't successful. What I did is I created a /etc/systemd/system/apt- daily.timer.d/override.conf with the following contents:
[Timer] OnCalendar=*-*-* 00:00 RandomizedDelaySec=6h unattended-upgrade ran and rebooted my server at 1:27 AM, at which point journalctl shows Nov 10 01:27:36 fridge systemd[1]: apt-daily.timer: Adding 4h 13min 49.738746s random time. Nov 10 01:27:36 fridge systemd[1]: Started Daily apt activities. which would lead me to expect another run at 6:40 AM (which is already outside my desired hours, but okay, not too bad). Instead, what I got was Nov 10 01:29:02 fridge systemd[1]: apt-daily.timer: Adding 3h 12min 35.192149s random time. and then Nov 10 09:13:06 fridge systemd[1]: Starting Daily apt activities... which rudely interrupted my morning Mutt session with another reboot. Bug in systemd's timers? -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, 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 -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp