[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1001320: needrestart misdetects socket activated ssh and restarts service instead of socket



Package: openssh-server
Version: 1:8.7p1-2
Severity: minor

Hi,

I am running a number of test systems with ssh as socket activated
service. Sometimes, after an update, I find myself without ssh access to
those systems (connection refused). After a console login and systemctl
restart ssh.socket, things are fine again.

I THINK this might be connected to needrestart. Today, a libc6 update
marked the running ssh daemon (that I was using for the update) as using
obsolete libraries, which resulted in the following console output:

Restarting services...
 systemctl restart console-log.service cron.service exim4.service haveged.service ippl.service ntp.service rsyslog.service serial-getty@ttyS0.service ssh.service systemd-journald.service systemd-networkd.service systemd-resolved.service systemd-udevd.service
Job for ssh.service failed because the control process exited with error code.
See "systemctl status ssh.service" and "journalctl -xeu ssh.service" for details.
Service restarts being deferred:
 /etc/needrestart/restart.d/dbus.service
 systemctl restart getty@tty1.service
 systemctl restart systemd-logind.service
 systemctl restart user@1001.service

and the following log entries:
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping LSB: Puts a logfile pager on virtual consoles...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping Regular background program processing daemon...
Dec  8 12:58:26 emptybookworm82 systemd[1]: cron.service: Deactivated successfully.
Dec  8 12:58:26 emptybookworm82 cron[429258]: (CRON) INFO (pidfile fd = 3)
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopped Regular background program processing daemon.
Dec  8 12:58:26 emptybookworm82 systemd[1]: cron.service: Consumed 15min 4.856s CPU time.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Started Regular background program processing daemon.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping LSB: exim Mail Transport Agent...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping Entropy Daemon based on the HAVEGE algorithm...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping LSB: IP protocols logger...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping Network Time Service...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping System Logging Service...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping Serial Getty on ttyS0...
Dec  8 12:58:26 emptybookworm82 systemd[1]: serial-getty@ttyS0.service: Deactivated successfully.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopped Serial Getty on ttyS0.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Started Serial Getty on ttyS0.
Dec  8 12:58:26 emptybookworm82 systemd[1]: ssh.socket: Deactivated successfully.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Closed OpenBSD Secure Shell server socket.
Dec  8 12:58:26 emptybookworm82 systemd[1]: ssh.socket: Consumed 10.571s CPU time.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Starting OpenBSD Secure Shell server...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping Flush Journal to Persistent Storage...
Dec  8 12:58:26 emptybookworm82 systemd[1]: systemd-networkd-wait-online.service: Deactivated successfully.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopped Wait for Network to be Configured.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping Wait for Network to be Configured...
Dec  8 12:58:26 emptybookworm82 systemd[1]: Stopping Network Name Resolution...
Dec  8 12:58:26 emptybookworm82 systemd[1]: ssh.service: Main process exited, code=exited, status=255/EXCEPTION
Dec  8 12:58:26 emptybookworm82 systemd[1]: ssh.service: Failed with result 'exit-code'.
Dec  8 12:58:26 emptybookworm82 systemd[1]: Failed to start OpenBSD Secure Shell server.
Dec  8 12:58:26 emptybookworm82 ntpd[298]: ntpd exiting on signal 15 (Terminated)
Dec  8 12:58:26 emptybookworm82 ntpd[298]: 2a01:4f8:140:246a::2 local addr 2a01:4f8:140:246a::52:100 -> <null>
Dec  8 12:58:26 emptybookworm82 haveged[220]: haveged: Stopping due to signal 15
Dec  8 12:58:27 emptybookworm82 cron[429258]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Dec  8 12:58:27 emptybookworm82 systemd[1]: systemd-journal-flush.service: Deactivated successfully.
Dec  8 12:58:27 emptybookworm82 systemd[1]: Stopped Flush Journal to Persistent Storage.
Dec  8 12:58:27 emptybookworm82 exim4[429259]:  exim4_listener.

To me, this looks like needrestart misdetects the sshd process as having
been started by an ssh.service instead of an ssh@.service, and that
stopping ssh.service stops ssh.socket for some reason (systemd
dependency?). Afterwards, ssh.service is restarted (which fails because
the port is still busy), and ssh.socket stays off, resulting in an
unreachable host.

Can you as the ssh maintainer give some insight whether this is an ssh,
a needrestart or an systemd issue? It definetely is annoying.

Greetings
Marc


Reply to: