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

Bug#778913: openssh-server: init (at least systemd) doesn't notice when sshd fails to start and reports success



Am 12.05.2015 um 17:07 schrieb Michael Biebl:
> root@pluto:~# echo foobar >> /etc/ssh/sshd_config 
> 
> root@pluto:~# systemctl restart ssh.service 
> Job for ssh.service failed. See 'systemctl status ssh.service' and 'journalctl -xn' for details.
> 
> root@pluto:~# systemctl status ssh.service 
> ● ssh.service - OpenBSD Secure Shell server
>    Loaded: loaded (/etc/systemd/system/ssh.service; enabled)
>    Active: failed (Result: start-limit) since Di 2015-05-12 17:03:51 CEST; 5s ago
>   Process: 13053 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255)
>  Main PID: 13053 (code=exited, status=255)
> 
> Mai 12 17:03:51 pluto sshd[13053]: /etc/ssh/sshd_config: terminating, 1 bad configuration options
> Mai 12 17:03:51 pluto systemd[1]: ssh.service: main process exited, code=exited, status=255/n/a
> Mai 12 17:03:51 pluto systemd[1]: Failed to start OpenBSD Secure Shell server.
> Mai 12 17:03:51 pluto systemd[1]: Unit ssh.service entered failed state.
> Mai 12 17:03:51 pluto systemd[1]: ssh.service start request repeated too quickly, refusing to start.
> Mai 12 17:03:51 pluto systemd[1]: Failed to start OpenBSD Secure Shell server.
> Mai 12 17:03:51 pluto systemd[1]: Unit ssh.service entered failed state.
> 
> 
> As you can see, systemd tries to repeatedly start the service until it hits
> start-limit.
> We should use sd_notify in that case to pass a correct error code to systemd.

Or we could use what's been proposed by Colin, i.e.
 ExecStartPre=/usr/bin/sshd -t
or my
 RestartPreventExitStatus=255

The latter has the benefit, that we don't need to parse the config twice
and there is no race condition between ExecStartPre and ExecStart where
the config file might have been modified.

-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: