无法通过 ssh 连接到 Snappy Ubuntu Core

无法通过 ssh 连接到 Snappy Ubuntu Core

我已经使用 KVM 安装了 Snappy Ubuntu Core alpha,但无法使用 SSH 连接到它。

SSH 返回ssh_exchange_identification: read: Connection reset by peer,这看起来像是图像的服务器端错误。

主机系统是Ubuntu 14.10 Desktop。

安装说明:http://blog.dustinkirkland.com/2014/12/its-a-snap.html

$ sudo apt-get install kvm

$ kvm-ok
INFO: /dev/kvm exists
KVM acceleration can be used

$ wget http://cdimage.ubuntu.com/ubuntu-core/preview/ubuntu-core-alpha-01.img

$ kvm -redir :2222::22 -redir :4443::443 ubuntu-core-alpha-01.img

映像似乎正在运行:预期的 QEMU 窗口打开,“正在从磁盘启动...”。QEMU 进程开始在顶部使用 CPU 和 MEM。QEMU 开始监听相应的端口:

$ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address State    PID/Program name
tcp        0      0 0.0.0.0:2222            0.0.0.0:*       LISTEN   11303/qemu-system-x
[...]
tcp        0      0 0.0.0.0:4443            0.0.0.0:*       LISTEN   11303/qemu-system-x
[...]
$

没有防火墙规则阻止主机上的端口 22、443、2222 或 4443:

$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:domain
ACCEPT     udp  --  anywhere             anywhere             udp dpt:domain
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:bootps
ACCEPT     udp  --  anywhere             anywhere             udp dpt:bootps

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination 

在另一个终端窗口中,我尝试通过 ssh 进入 Snappy Ubuntu Core 系统:

$ ssh -vv -p 2222 ubuntu@localhost
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to localhost [127.0.0.1] port 2222.
debug1: Connection established.
debug1: identity file /home/ian/.ssh/id_rsa type 1
debug1: identity file /home/ian/.ssh/id_rsa-cert type -1
debug1: identity file /home/ian/.ssh/id_dsa type 2
debug1: identity file /home/ian/.ssh/id_dsa-cert type -1
debug1: identity file /home/ian/.ssh/id_ecdsa type -1
debug1: identity file /home/ian/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/ian/.ssh/id_ed25519 type -1
debug1: identity file /home/ian/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-8
ssh_exchange_identification: read: Connection reset by peer
$

我是不是搞错了?或者这可能是一个 bug?

答案1

感谢#snappy IRC 中的专家,他们解决了这个问题。

首先,snappy 映像需要 64 位主机。我的主机运行的是 32 位,因此 QEMU 可以加载映像,但无法运行它。目前,尚未构建 32 位版本的 Snappy Ubuntu Core。

如果我使用的是 64 位主机,如果 KVM 提前停止(在 ssh 密钥生成之前或期间),也可能会出现类似的情况。两种可能的解决方案:1) 下载新映像,或 2) 通过控制台(而不是 ssh)登录并删除/etc/ssh/*host*文件。

相关内容