[500XRP悬赏] OpenVZ ubuntu10.04 中 SSH 无法启动的问题

2014-01-07 10:04:13 +08:00
 andybest
一台 OpenVZ 的 VPS ,在重启后 SSH 服务无法启动,仅能通过管理后台使用 “Serial Console” 登录

目前出问题的 VPS 的所有进程:
root@ssd:/# ps auxf
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 1.0 2504 1360 ? Ss 09:50 0:00 init
root 2 0.0 0.0 0 0 ? S 09:50 0:00 [kthreadd/1980]
root 3 0.0 0.0 0 0 ? S 09:50 0:00 \_ [khelper/1980]
root 270 0.0 0.6 2336 884 ? Ss 09:50 0:00 cron
root 354 0.0 0.5 27496 760 ? Ss 09:51 0:00 vzctl: pts/0
root 355 0.0 1.2 3004 1644 pts/0 Ss 09:51 0:00 \_ -bash
root 367 0.0 0.6 2392 856 pts/0 R+ 09:51 0:00 \_ ps auxf

root@ssd:/# netstat -nl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 2875821005 @/com/ubuntu/upstart


尝试 ssh restart 与 ssh start 均无法启动 ssh 服务:

root@ssd:/# /etc/init.d/ssh restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service ssh restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the restart(8) utility, e.g. restart ssh
ssh stop/pre-start, process 386

root@ssd:/# /etc/init.d/ssh start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service ssh start

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start ssh
ssh stop/pre-start, process 399

root@ssd:/# netstat -nl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 2875821005 @/com/ubuntu/upstart


安装 dropbear 在其他端口,并启动,同样无法启动:
root@ssd:~# /etc/init.d/dropbear start
Starting Dropbear SSH server: dropbear.

root@ssd:~# netstat -nl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node Path
unix 2 [ ACC ] STREAM LISTENING 2875821005 @/com/ubuntu/upstart

-----------------------------------------------------------------------------------------------------

这个问题多次出现在 OpenVZ 的 ubuntu VPS 中,都是正常使用时,重启系统后 SSH 无法启动,参考帖子:
http://lowendtalk.com/discussion/9076/weird-can-t-start-ssh-service-on-a-openvz-vps

始终没有任何办法能解决,最后都是重新安装系统
(但同样的问题从未出现在 KVM / XEN 架构的 VPS,仅出现在 OpenVZ)

如果能帮助我,或者引导我通过查看日志之类的最终能解决问题,我愿意赠送 500XRP 表示感谢
感谢各位! :)
5774 次点击
所在节点    问与答
50 条回复
andybest
2014-01-07 15:02:57 +08:00
@juicy 请问收到 XRP 了吗?我这没有显示记录呢
andybest
2014-01-07 15:05:33 +08:00
@lijinma 多谢,你的回答也是正确的,但 @juicy 直接帮我解决了问题,所以真不好意思,唯有感谢了! :")
juicy
2014-01-07 15:06:43 +08:00
@andybest 好像还没收到, 你填的地址应该没错吧
andybest
2014-01-07 15:10:47 +08:00
@juicy 没填错,我又发了一次,这次我余额减了500了,转账记录:
Address sent to:rhRpVb7eXvj2ybmdTi6EeARKa6X26Rf3XK
Amount received:500 XRP
Currency received:XRP

应该收到了吧,多谢啊! :)))
juicy
2014-01-07 15:12:00 +08:00
@juicy 刚刚收到了, 感谢楼主。

另外, 如果重启之后/dev/null还是有问题, 推荐楼主可以将

rm /dev/null
mknod /dev/null c 1 3

加入 /etc/rc.local 中

这样每次重启, 系统就能自动帮你完成新建/dev/null的过程
andybest
2014-01-07 15:13:58 +08:00
@juicy 好,是不是再遇到这个问题,我直接执行:
rm /dev/null
mknod /dev/null c 1 3

即可解决了?是不是没必要用这个:
mkdir /var/run/sshd
chmod 0755 /var/run/sshd

也就是,是不是就是 /dev/null 的问题?
juicy
2014-01-07 15:19:02 +08:00
@andybest 这个我也不确定, 都有可能吧, 楼主自测一下应该就能知道了。 不过我记得脚本里有一段是去查找/var/run/sshd是否存在,不存在就新建的代码, 所以可能就不需要了。 之前没有创建/var/run/sshd可能是程序还没有执行到那一步

如果真的有必要手动添加, 那和上面一样, 将下面的代码加到 /etc/rc.local 里

if [ ! -d /var/run/sshd ]; then
mkdir /var/run/sshd
chmod 0755 /var/run/sshd
fi
juicy
2014-01-07 15:22:45 +08:00
。。。楼主多发了500XRP, 马上退给楼主。。。。。
juicy
2014-01-07 15:24:45 +08:00
。。。好像网页端展现有问题, history里出现了两条相同的记录, 我还以为是楼主多发了。。。
andybest
2014-01-07 15:34:06 +08:00
@juicy 多谢!! :)

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/95943

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX