我正在研究一块嵌入式Linux板,在启动时我注意到了以下情况:
[FAILED] Failed to start OpenBSD Secure Shell server.
然后我跑了一下sudo systemctl status sshd
,得到了这个:
[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
我发现的所有帮助都假设可以绑定的地址已被使用。但对我来说,这从一开始就不起作用。有趣的是,如果我运行它,它就会sudo systemctl start sshd
开始工作,我得到:
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.
为什么它在启动时不绑定?我可以让它正常工作而无需任何更改,这表明没有问题,所以我不知道缺少了什么。
答案1
全新安装 Debian 11 后出现同样的错误。
通过在我的 /etc/network/interfaces 中添加“auto enp7s0”来解决此问题
当然,用你的接口网络名称更改“enp7s0”。
“auto”指定您想要在启动时启动的界面。
似乎在安装过程中选择手动网络配置时,Debian 11 安装不会将其添加到配置中。可能你和我一样选择了这个。