Public bug reported: Thanks to the change described in https://discourse.ubuntu.com/t/needrestart-changes-in- ubuntu-24-04-service-restarts/44671 one can end up with situation where you have ssh connection to a server and run `sudo apt dist-upgrade` and `needsrestart` will kill the network connection for your ssh connection before the command finishes.
In example case the final lines of output I saw was as follows: ``` Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. The processor microcode seems to be up-to-date. Restarting services... systemctl restart accounts-daemon.service atd.service cron.service [email protected] multipathd.service munin-node.service ntpsec.service opendkim.service packagekit.service polkit.service [email protected] rsyslog.service smartmontools.service spamd.service thermald.service ``` I think [email protected] was the service that killed my ssh connection and to make things worse, I couldn't reconnect to the system using said connection before full system restart so "restarting" the network connection failed somehow. Luckily this remote server had other ways to restart the system! At very least needsrestart should delay killing network connection until there are no existing ssh connection, preferably no connections of any kind. Feel free to randomly restart things if `unattended-upgrades` is doing the upgrade but do not mess with existing connections if user is running apt manually! ** Affects: needrestart (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Debcrafters packages, which is subscribed to needrestart in Ubuntu. https://bugs.launchpad.net/bugs/2120446 Title: needsrestart may kill existing ssh connection without a warning Status in needrestart package in Ubuntu: New Bug description: Thanks to the change described in https://discourse.ubuntu.com/t/needrestart-changes-in- ubuntu-24-04-service-restarts/44671 one can end up with situation where you have ssh connection to a server and run `sudo apt dist- upgrade` and `needsrestart` will kill the network connection for your ssh connection before the command finishes. In example case the final lines of output I saw was as follows: ``` Restarting the system to load the new kernel will not be handled automatically, so you should consider rebooting. The processor microcode seems to be up-to-date. Restarting services... systemctl restart accounts-daemon.service atd.service cron.service [email protected] multipathd.service munin-node.service ntpsec.service opendkim.service packagekit.service polkit.service [email protected] rsyslog.service smartmontools.service spamd.service thermald.service ``` I think [email protected] was the service that killed my ssh connection and to make things worse, I couldn't reconnect to the system using said connection before full system restart so "restarting" the network connection failed somehow. Luckily this remote server had other ways to restart the system! At very least needsrestart should delay killing network connection until there are no existing ssh connection, preferably no connections of any kind. Feel free to randomly restart things if `unattended-upgrades` is doing the upgrade but do not mess with existing connections if user is running apt manually! To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/needrestart/+bug/2120446/+subscriptions -- Mailing list: https://launchpad.net/~debcrafters-packages Post to : [email protected] Unsubscribe : https://launchpad.net/~debcrafters-packages More help : https://help.launchpad.net/ListHelp

