I'm working on an embedded linux board and I noticed the following on boot:
[FAILED] Failed to start OpenBSD Secure Shell server.
Then I ran sudo systemctl status sshd
and got this:
[sudo] password for debian:
ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: failed (Result: exit-code) since Mon 2022-05-23 19:43:25 UTC; 33s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 639 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Process: 684 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255/E
Main PID: 684 (code=exited, status=255/EXCEPTION)
May 23 19:43:23 iot-server systemd[1]: Starting OpenBSD Secure Shell server...
May 23 19:43:24 iot-server sshd[684]: error: Bind to port 22 on 192.168.1.120 fa
May 23 19:43:24 iot-server sshd[684]: fatal: Cannot bind any address.
May 23 19:43:25 iot-server systemd[1]: ssh.service: Main process exited, code=ex
May 23 19:43:25 iot-server systemd[1]: ssh.service: Failed with result 'exit-cod
May 23 19:43:25 iot-server systemd[1]: Failed to start OpenBSD Secure Shell serv
All help I've found assumes that the address that can be bound is already in use. But for me this doesn't work from the start. The interesting thing is that if I run sudo systemctl start sshd
then it starts to work and I get:
ssh.service - OpenBSD Secure Shell server
Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enab
Active: active (running) since Mon 2022-05-23 19:53:01 UTC; 4s ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 1471 ExecStartPre=/usr/sbin/sshd -t (code=exited, status=0/SUCCESS)
Main PID: 1472 (sshd)
Tasks: 1 (limit: 1026)
Memory: 700.0K
CGroup: /system.slice/ssh.service
|_ 1472 /usr/sbin/sshd -D
May 23 19:53:01 iot-server systemd[1]: Starting OpenBSD Secure Shell server...
May 23 19:53:01 iot-server sshd[1472]: Server listening on 192.168.1.120 port 22
May 23 19:53:01 iot-server systemd[1]: Started OpenBSD Secure Shell server.
Why is it not binding on boot? The fact that I can make it work just fine without changes indicates that there is no problem, so I don't know what's missing.