Services restarted by unattended upgrades because of /etc/needrestart/restart.d/systemd-manager

Wiebe Cazemier wiebe at halfgaar.net
Wed Jun 5 09:21:16 UTC 2024


Hi,

Despite configured with the default not to ($nrconf{restart} = 'i'), unattended upgrades often restarts everything on Ubuntu 24.04 servers. This is highly undesirable, and contra to the supposed default. I have not observed this behavior on earlier Ubuntus.

The log '/var/log/unattended-upgrades/unattended-upgrades-dpkg.log' says:


> Restarting services...
> systemctl restart cron.service irqbalance.service multipathd.service ntpsec.service packagekit.service polkit.service postfix at -.service redis-server.service rpcbind.service rsyslog.service salt-minion.service udisks2.service
> 
> Service restarts being deferred:
>  systemctl restart ModemManager.service
>  /etc/needrestart/restart.d/dbus.service
>  systemctl restart networkd-dispatcher.service
>  systemctl restart systemd-logind.service
>  systemctl restart unattended-upgrades.service
> 
> No containers need to be restarted.
> 
> User sessions running outdated binaries:
>  root @ session #5: bash[1804], sshd[1727], tmux: server[2012]
>  root @ user manager service: systemd[1732]
> 
> No VM guests are running outdated hypervisor (qemu) binaries on this host.
> Log ended: 2024-06-05  09:46:05


The conf /etc/needrestart/needrestart.conf contains:


# Restart mode: (l)ist only, (i)nteractive or (a)utomatically.
#
# ATTENTION: If needrestart is configured to run in interactive mode but is run
# non-interactive (i.e. unattended-upgrades) it will fallback to list only mode.
#
#$nrconf{restart} = 'i';


The fact that '/etc/needrestart/restart.d/systemd-manager' executes 'systemctl daemon-reexec', which restarts a bunch of services, seems like a bug to me. The log is talking about deferred restarts, after it actually restarted stuff.

My expected behavior is that when I configure it to not restart services, services are not restarted.

Regards,

Wiebe



More information about the Ubuntu-devel-discuss mailing list