On Sat, Dec 19 2020 at 06:34:35 PM, Jesper Dybdal <jd-debian-u...@dybdal.dk> wrote: > On 2020-12-19 17:14, Dan Ritter wrote: >> Jesper Dybdal wrote: >>> I run Buster with unattended updates configured to allow reboots. >>> >>> Sometimes after an update, the log contains: >>> >>>> Service restarts being deferred: >>>> ??systemctl restart systemd-logind.service >>>> ??systemctl restart unattended-upgrades.service >>> I don't understand why these services are not restarted, if necessary >>> through a reboot. >>> >>> I want my system to be able to run truly unattended for a long time, so >>> necessary restarts should be done without waiting for manual intervention.?? >>> And if the restarts are not necessary, why are they there at all, though >>> deferred? >>> >>> So what have I misunderstood? >> In your /etc/apt/apt.conf.d, edit a file named 50unattended-upgrades >> >> // Automatically reboot *WITHOUT CONFIRMATION* if >> // the file /var/run/reboot-required is found after the upgrade >> Unattended-Upgrade::Automatic-Reboot "true"; >> >> // Automatically reboot even if there are users currently logged >> // in. >> Unattended-Upgrade::Automatic-Reboot-WithUsers "true"; >> >> Without those two lines, you get the behavior you currently >> have. >> >> Not everyone wants automatic reboots; not everyone wants >> automatic reboots even with someone logged in. > > Thanks. > I already have Automatic-Reboot set, and it correctly causes reboot > after for instance kernel upgrades. > I do not have Automatic-Reboot-WithUsers set, since I did not imagine > it would make a difference when there actually are no users logged in. > But I'll try setting it also and see if that somehow makes a difference.
>From the documentation of Automatic-Reboot, it only has effect for updates that result in the /var/run/reboot-required file being created. For service restarts, the needrestart configuration would be a better place to start. The comments in /etc/needrestart/needrestart.conf are instructive: # do not restart oneshot services, see also #862840 qr(^apt-daily\.service$) => 0, qr(^apt-daily-upgrade\.service$) => 0, qr(^unattended-upgrades\.service$) => 0, # don't restart systemd-logind, see #798097 qr(^systemd-logind) => 0, Do go through those bug reports and experiment at a safe time before changing things here. -- regards, kushal