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

Simon Chopin simon.chopin at canonical.com
Wed Jun 5 10:54:37 UTC 2024


Hi Wiebe,

The default behaviour of needrestart *when invoked via APT* was indeed
changed in 24.0, as mentioned in the release notes[0] and a dedicated
Discourse thread[1].

Now, I agree that we probably should amend the comments in the
configuration file to reflect this. I also tried to make any explicit
setting take precedence over the custom Ubuntu behaviour, so if
you in fact have uncommented that line, that's indeed a bug.

Would you mind reporting this on Launchpad, though?

Cheers,
Simon

[0]: https://discourse.ubuntu.com/t/ubuntu-24-04-lts-noble-numbat-release-notes/39890#services-restart-on-unattended-upgrade-27
[1]: https://discourse.ubuntu.com/t/needrestart-changes-in-ubuntu-24-04-service-restarts/44671

On mer. 05 juin 2024 11:21:16, Wiebe Cazemier wrote:
> 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
>
> --
> Ubuntu-devel-discuss mailing list
> Ubuntu-devel-discuss at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-devel-discuss



More information about the Ubuntu-devel-discuss mailing list