Ale*_*lex 6 embedded busybox init.d raspberry-pi buildroot
我已经使用树莓派的 buildroot 的默认配置完成了最小安装。我还从 menuconfig 中选择了 openssh 和 openssl:
Package Selection for the target --->
[*] Networking --->
[*] openssh
[*] Library -->
Crypto -->
-*- openssl
[*] openssl binary
[ ] openssl additional engines
Run Code Online (Sandbox Code Playgroud)
我将 Pi 分配给了192.168.0.14
,但无法通过 ssh 连接到它。nmap 显示 Pi 的所有端口都已关闭,有时根本不显示 Pi,我觉得这很奇怪——每当 nmap 扫描它时,LINK LED 就会闪烁,所以我猜它连接得很好。
我通常使用update-rc.d
或管理启动服务systemctl
,但是我只能通过 ssh 连接到 Pi - 我没有 HDMI 或串行端口。我不确定如何手动设置。/etc/init.d/S50sshd
存在于 Pi 中,所以它应该在启动后启动 ssh,不是吗?
相关配置文件:/etc/ssh/sshd_config
, /etc/init.d/S50sshd
.
我在 SD 卡中找不到任何相关日志。
编辑:
根据 X Tian 从评论中提出的建议,我能够获得日志。唯一记录的是/var/log/messages
. 相关部分:
Jan 1 00:00:02 buildroot auth.info sshd[75]: Server listening on 0.0.0.0 port 22.
Run Code Online (Sandbox Code Playgroud)
似乎 sshd 正在启动。问题似乎是别的。
root@pc:~# ssh 192.168.0.14
ssh: connect to host 192.168.0.14 port 22: Connection refused
root@pc:~# ping 192.168.0.14
PING 192.168.0.14 (192.168.0.14) 56(84) bytes of data.
64 bytes from 192.168.0.14: icmp_seq=1 ttl=64 time=32.8 ms
64 bytes from 192.168.0.14: icmp_seq=2 ttl=64 time=55.6 ms
64 bytes from 192.168.0.14: icmp_seq=3 ttl=64 time=79.1 ms
^C
--- 192.168.0.14 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 32.808/55.871/79.140/18.917 ms
root@pc:~# exit
debian@pc:~ nmap -F 192.168.0.14
Starting Nmap 6.47 ( http://nmap.org ) at 2015-05-30 03:25 BRT
Nmap scan report for 192.168.0.14
Host is up (0.085s latency).
All 100 scanned ports on 192.168.0.14 are closed
Run Code Online (Sandbox Code Playgroud)
有趣的是,在关闭 Pi 并断开以太网电缆后,我仍然能够 ping 那个地址。现在我真的迷路了。我认为最好只是 tar 并上传/ 下的所有文件,如果有人知道在哪里查看(这不是生产环境,密码和私钥未使用,它们是为测试目的而设置的)。
/etc/init.d/S50sshd 存在于 Pi 中,因此它应该在启动后启动 ssh,不是吗?
不完全是。该/etc/init.d/S50sshd
文件已被使用,但调用的是相应运行级别文件夹中的文件。当您运行时,update-rc.d
它只是在所需文件夹的 init.d 中创建指向 S50sshd 的符号链接/etc/rc?.d/
。
您可以通过以下方式查看当前状态:
ls etc/rc*.d/*ssh*
Run Code Online (Sandbox Code Playgroud)
(我希望它出现在运行级别 2、3、4 和 5 上)
并使用以下命令创建它们:
ln -s /etc/init.d/ssh /etc/rc2.d
ln -s /etc/init.d/ssh /etc/rc3.d
ln -s /etc/init.d/ssh /etc/rc4.d
ln -s /etc/init.d/ssh /etc/rc5.d
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7990 次 |
最近记录: |