What is the syntax of the SSH command used by packer.io?

707 views
Skip to first unread message

Verachten Bruno

unread,
Jul 22, 2015, 4:05:01 AM7/22/15
to Packer
Hi,

I'm currently trying to use packer.io starting from an ISO with VirtualBox.
The target system is kind of exotic, it's Android-x86.
The SSH server is openssh, and it's using the key from my machine thanks to the "http_directory" option.

Anyway, I can manually ssh into the machine after the "StepTypeBootCommand" step.
==> virtualbox-iso: Pausing after run of step 'StepTypeBootCommand'. Press enter to continue.

ssh root@localhost -p 3876
The authenticity of host '[localhost]:3876 ([127.0.0.1]:3876)' can't be established.
RSA key fingerprint is SHA256:L76j7I5YHbQ+YHd6vLjjyjro1WAbA//pHliNcu6vm8o.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:3876' (RSA) to the list of known hosts.
lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
lastlog_openseek: Couldn't stat /var/log/lastlog: No such file or directory
debug1: permanently_set_uid: 0/0
Environment:
  USER=root
  LOGNAME=root
  HOME=/
  PATH=/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
  MAIL=/var/mail/root
  SHELL=/system/bin/sh
  SSH_CLIENT=10.0.2.2 53005 22
  SSH_CONNECTION=10.0.2.2 53005 10.0.2.15 22
  SSH_TTY=/dev/ptmx
  TERM=xterm
void endpwent()(3) is not implemented on Android
root@x86:/ #


When I let packer go to the next step, I get:
2015/07/22 09:59:40 packer-builder-virtualbox-iso.exe: 2015/07/22 09:59:40 [INFO] Attempting SSH connection...
2015/07/22 09:59:40 packer-builder-virtualbox-iso.exe: 2015/07/22 09:59:40 reconnecting to TCP connection for SSH
2015/07/22 09:59:40 packer-builder-virtualbox-iso.exe: 2015/07/22 09:59:40 handshaking with SSH
2015/07/22 09:59:40 packer-builder-virtualbox-iso.exe: 2015/07/22 09:59:40 handshake error: ssh: handshake failed: WSARecv tcp 127.0.0.1:53096: An established connection was aborted by the software in your host machine.
2015/07/22 09:59:40 packer-builder-virtualbox-iso.exe: 2015/07/22 09:59:40 [DEBUG] SSH handshake err: ssh: handshake failed: WSARecv tcp 127.0.0.1:53096: An established connection was aborted by the software in your host machine.


In the server logs, I can see:

uid=0(root) gid=0(root)@x86:/ # W/libc    ( 2479): void endpwent()(3) is not implemented on Android
I/sshd    ( 2478): debug3: fd 5 is not O_NONBLOCK
I/sshd    ( 2478): debug1: Server will not fork when running in debugging mode.
I/sshd    ( 2478): debug3: send_rexec_state: entering fd = 8 config len 307
I/sshd    ( 2478): debug3: ssh_msg_send: type 0
I/sshd    ( 2478): debug3: send_rexec_state: done
I/sshd    ( 2478): debug1: rexec start in 5 out 5 newsock 5 pipe -1 sock 8
I/sshd    ( 2478): debug3: recv_rexec_state: entering fd = 5
I/sshd    ( 2478): debug3: ssh_msg_recv entering
I/sshd    ( 2478): debug3: recv_rexec_state: done
I/sshd    ( 2478): debug2: parse_server_config: config rexec len 307
I/sshd    ( 2478): debug3: rexec:19 setting Protocol 2
I/sshd    ( 2478): debug3: rexec:24 setting HostKey /data/ssh/ssh_host_rsa_key
I/sshd    ( 2478): debug3: rexec:25 setting HostKey /data/ssh/ssh_host_dsa_key
I/sshd    ( 2478): debug3: rexec:49 setting AuthorizedKeysFile /data/ssh/authorized_keys
I/sshd    ( 2478): debug3: rexec:62 setting PasswordAuthentication no
I/sshd    ( 2478): debug3: rexec:114 setting Subsystem sftp     /usr/libexec/sftp-server
I/sshd    ( 2478): debug1: sshd version OpenSSH_5.9p1
I/sshd    ( 2478): void endpwent()(3) is not implemented on Android
I/sshd    ( 2478): debug3: Incorrect RSA1 identifier
I/sshd    ( 2478): debug1: read PEM private key done: type RSA
I/sshd    ( 2478): debug1: private host key: #0 type 1 RSA
I/sshd    ( 2478): debug3: Incorrect RSA1 identifier
I/sshd    ( 2478): debug1: read PEM private key done: type DSA
I/sshd    ( 2478): debug1: private host key: #1 type 2 DSA
I/sshd    ( 2478): debug1: inetd sockets after dupping: 3, 3
I/sshd    ( 2478): Connection from 10.0.2.2 port 53146
I/sshd    ( 2478): Did not receive identification string from 10.0.2.2
I/sshd    ( 2478): sshd terminated by exit(255)
I/sshd    ( 2482): debug2: load_server_config: filename /system/etc/ssh/sshd_config
I/sshd    ( 2482): debug2: load_server_config: done config len = 307
I/sshd    ( 2482): debug2: parse_server_config: config /system/etc/ssh/sshd_config len 307
I/sshd    ( 2482): debug3: /system/etc/ssh/sshd_config:19 setting Protocol 2
I/sshd    ( 2482): debug3: /system/etc/ssh/sshd_config:24 setting HostKey /data/ssh/ssh_host_rsa_key
I/sshd    ( 2482): debug3: /system/etc/ssh/sshd_config:25 setting HostKey /data/ssh/ssh_host_dsa_key
I/sshd    ( 2482): debug3: /system/etc/ssh/sshd_config:49 setting AuthorizedKeysFile /data/ssh/authorized_keys
I/sshd    ( 2482): debug3: /system/etc/ssh/sshd_config:62 setting PasswordAuthentication no
I/sshd    ( 2482): debug3: /system/etc/ssh/sshd_config:114 setting Subsystem sftp       /usr/libexec/sftp-server
I/sshd    ( 2482): debug1: sshd version OpenSSH_5.9p1
W/libc    ( 2483): void endpwent()(3) is not implemented on Android
I/sshd    ( 2482): void endpwent()(3) is not implemented on Android
I/sshd    ( 2482): debug3: Incorrect RSA1 identifier
I/sshd    ( 2482): debug1: read PEM private key done: type RSA
I/sshd    ( 2482): debug1: private host key: #0 type 1 RSA
I/sshd    ( 2482): debug3: Incorrect RSA1 identifier
I/sshd    ( 2482): debug1: read PEM private key done: type DSA
I/sshd    ( 2482): debug1: private host key: #1 type 2 DSA
I/sshd    ( 2482): debug1: rexec_argv[0]='/system/bin/sshd'
I/sshd    ( 2482): debug1: rexec_argv[1]='-f'
I/sshd    ( 2482): debug1: rexec_argv[2]='/system/etc/ssh/sshd_config'
I/sshd    ( 2482): debug1: rexec_argv[3]='-D'
I/sshd    ( 2482): debug1: rexec_argv[4]='-d'
I/sshd    ( 2482): debug1: rexec_argv[5]='-d'
I/sshd    ( 2482): debug1: rexec_argv[6]='-d'
I/sshd    ( 2482): debug1: rexec_argv[7]='-e'
I/sshd    ( 2482): debug3: oom_adjust_setup
I/sshd    ( 2482): Set /proc/self/oom_score_adj from -16 to -1000
I/sshd    ( 2482): debug2: fd 3 setting O_NONBLOCK
I/sshd    ( 2482): debug3: sock_set_v6only: set socket 3 IPV6_V6ONLY
I/sshd    ( 2482): debug1: Bind to port 22 on ::.
I/sshd    ( 2482): Server listening on :: port 22.
I/sshd    ( 2482): debug2: fd 4 setting O_NONBLOCK
I/sshd    ( 2482): debug1: Bind to port 22 on 0.0.0.0.
I/sshd    ( 2482): Server listening on 0.0.0.0 port 22.

I just don't get what's going on. I neither know what command packer.io uses to ssh into the machine, nor why it fails.

Do you have any idea?

Thanks.

Bruno Verachten


ha...@meddlingmojo.com

unread,
Jul 27, 2015, 12:44:53 PM7/27/15
to Packer, goun...@gmail.com
On Wednesday, July 22, 2015 at 9:05:01 AM UTC+1, Verachten Bruno wrote:
[snip]


I just don't get what's going on. I neither know what command packer.io uses to ssh into the machine, nor why it fails.

Note that Packer uses the golang implementation of SSH (see: https://godoc.org/golang.org/x/crypto/ssh) rather than the command line OpenSSH client.


Cheers,

Hazel
Reply all
Reply to author
Forward
0 new messages