Bug#946997: /usr/sbin/sshd: sshd doesn't restart after dying
On Thu, Dec 19, 2019 at 09:38:11AM +0100, Xavier Bestel wrote:
> When sshd dies, it doesn't restart which makes the machine unreachable.
> E.g. try "sudo killall sshd", and voilà you can't use a headless machine anymore.
>
> Could this be fixed ?
I see from the information that reportbug attached that you're using
systemd.
As far as I can tell, systemd doesn't have a way to express this in the
particular example you gave. killall will kill processes using SIGTERM
by default, and systemd considers that to be a deliberate administrative
action, i.e. "you meant to do that", so Restart=on-failure won't apply.
This seems correct to me. However, if you kill sshd in an unclean way,
for example by sending SIGKILL, then systemd *will* restart it.
systemd.service(5) says:
If set to on-failure, the service will be restarted when the process
exits with a non-zero exit code, is terminated by a signal
(including on core dump, but excluding the aforementioned four
signals [SIGHUP, SIGINT, SIGTERM or SIGPIPE]), when an operation
(such as service reload) times out, and when the configured watchdog
timeout is triggered.
It feels like you filed a reduced bug report based on something more
complex happened in real life. If so, could you share the more complex
version?
--
Colin Watson [cjwatson@debian.org]
Reply to: