当Packer到达"等待SSH变得可用时......"步骤
我的日志显示
14:07:29 [INFO] Attempting SSH connection...
14:07:29 reconnecting to TCP connection for SSH
14:07:29 handshaking with SSH
14:07:29 handshake error: ssh: handshake failed: read tcp 127.0.0.1:60372->127.0.0.1:3057: read: connection reset by peer
14:07:29 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:60372->127.0.0.1:3057: read: connection reset by peer
14:07:36 [INFO] Attempting SSH connection...
14:07:36 reconnecting to TCP connection for SSH
14:07:36 handshaking with SSH
14:07:36 handshake error: ssh: handshake failed: read tcp 127.0.0.1:60376->127.0.0.1:3057: read: connection reset by peer
14:07:36 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:60376->127.0.0.1:3057: read: connection reset by peer
每次尝试时请注意不同的端口。
60372
60376
Packer每7秒尝试一个新端口。
有没有办法在构建之前或期间配置端口以避免这种尝试/失败方法?
答案 0 :(得分:1)
这是ssh连接的源端口。它由操作系统分配,具有随机可用的高端口。
答案 1 :(得分:0)
问题不在于SSH服务器或TCP / IP。这与Packer的设计方式有关。
创建VM时,Packer.io将运行引导命令。不同的机器需要时间和时间。在此期间,您将看到“等待SSH可用......”。在后台,Packer.io将尝试建立SSH连接。日志已经饱和了这样的消息
Linux
14:07:29 [INFO] Attempting SSH connection...
14:07:29 reconnecting to TCP connection for SSH
14:07:29 handshaking with SSH
14:07:29 handshake error: ssh: handshake failed: read tcp 127.0.0.1:60372->127.0.0.1:3057: read: connection reset by peer
14:07:29 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:60372->127.0.0.1:3057: read: connection reset by peer
或
Windows
15:54:31 packer.exe: 2017/02/01 15:54:31 [INFO] Attempting SSH connection...
15:54:31 packer.exe: 2017/02/01 15:54:31 reconnecting to TCP connection for SSH
15:54:31 packer.exe: 2017/02/01 15:54:31 handshaking with SSH
15:54:31 packer.exe: 2017/02/01 15:54:31 handshake error: ssh: handshake failed: read tcp 127.0.0.1:62691->127.0.0.1:4289: wsarecv: An existing connection was forcibly closed by the remote host.
15:54:31 packer.exe: 2017/02/01 15:54:31 [DEBUG] SSH handshake err: ssh: handshake failed: read tcp 127.0.0.1:62691->127.0.0.1:4289: wsarecv: An existing connection was forcibly closed by the remote host.
操作系统将启动并随之启用客户端上的SSH服务器。此时,应该建立从主机到访客的SSH连接。
在Windows 10 Pro和Ubuntu 16.04.1 TL上重现并确认