hashicorp / hashicorp/packer

SSH handshake err: ssh: handshake failed: EOF macOS VM 10.9 and 10.10

Open
#12,994 12 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
15.8k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Got one of the following errors ? See if the related guides can help.

- `Waiting for WinRM to become available` ?

- See our basic WinRm Packer guide: https://www.packer.io/guides/automatic-operating-system-installs/autounattend_windows

- `Waiting for SSH to become available` ?

- See our basic SSH Packer guide: https://www.packer.io/guides/automatic-operating-system-installs/preseed_ubuntu

Issues on GitHub are intended to be related to bugs or feature requests, so we recommend using our other community resources instead of asking here if you have a question.

- Packer Guides: https://www.packer.io/guides
- Discussion List: https://groups.google.com/group/packer-tool
- Any other questions can be sent to the packer section of the HashiCorp
forum: https://discuss.hashicorp.com/c/packer
- Packer community links: https://www.packer.io/community

This is what the server inside the machine supports:
```
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.2 (protocol 2.0)
| ssh2-enum-algos:
| kex_algorithms: (4)
| diffie-hellman-group-exchange-sha256
| diffie-hellman-group-exchange-sha1
| diffie-hellman-group14-sha1
| diffie-hellman-group1-sha1
| server_host_key_algorithms: (2)
| ssh-rsa
| ssh-dss
| encryption_algorithms: (15)
| aes128-ctr
| aes192-ctr
| aes256-ctr
| arcfour256
| arcfour128
| aes128-gcm@openssh.com
| aes256-gcm@openssh.com
| aes128-cbc
| 3des-cbc
| blowfish-cbc
| cast128-cbc
| aes192-cbc
| aes256-cbc
| arcfour
| rijndael-cbc@lysator.liu.se
| mac_algorithms: (19)
| hmac-md5-etm@openssh.com
| hmac-sha1-etm@openssh.com
| umac-64-etm@openssh.com
| umac-128-etm@openssh.com
| hmac-sha2-256-etm@openssh.com
| hmac-sha2-512-etm@openssh.com
| hmac-ripemd160-etm@openssh.com
| hmac-sha1-96-etm@openssh.com
| hmac-md5-96-etm@openssh.com
| hmac-md5
| hmac-sha1
| umac-64@openssh.com
| umac-128@openssh.com
| hmac-sha2-256
| hmac-sha2-512
| hmac-ripemd160
| hmac-ripemd160@openssh.com
| hmac-sha1-96
| hmac-md5-96
| compression_algorithms: (2)
| none
|_ zlib@openssh.com
```
Debugging `ssh` connection:
```
ssh -v -l vagrant 192.168.45.129
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-64-etm@openssh.com compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: umac-64-etm@openssh.com compression: none
debug3: send packet: type 34
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<3072<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug3: receive packet: type 31
debug1: SSH2_MSG_KEX_DH_GEX_GROUP received
debug2: bits set: 1543/3072
debug3: send packet: type 32
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug3: receive packet: type 33
debug1: SSH2_MSG_KEX_DH_GEX_REPLY received
debug1: Server host key: ssh-rsa SHA256:/0BrA93QVj1Sk4ndJVrRHtdPN3KH5lJM+pV5DwCaofE
debug1: load_hostkeys: fopen /Users/mbp151/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /usr/local/etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /usr/local/etc/ssh/ssh_known_hosts2: No such file or directory
debug3: hostkeys_find_by_key_hostfile: trying user hostfile "/Users/mbp151/.ssh/known_hosts"
debug3: hostkeys_foreach: reading file "/Users/mbp151/.ssh/known_hosts"
debug3: hostkeys_find_by_key_hostfile: trying user hostfile "/Users/mbp151/.ssh/known_hosts2"
debug1: hostkeys_find_by_key_hostfile: hostkeys file /Users/mbp151/.ssh/known_hosts2 does not exist
debug3: hostkeys_find_by_key_hostfile: trying system hostfile "/usr/local/etc/ssh/ssh_known_hosts"
debug1: hostkeys_find_by_key_hostfile: hostkeys file /usr/local/etc/ssh/ssh_known_hosts does not exist
debug3: hostkeys_find_by_key_hostfile: trying system hostfile "/usr/local/etc/ssh/ssh_known_hosts2"
debug1: hostkeys_find_by_key_hostfile: hostkeys file /usr/local/etc/ssh/ssh_known_hosts2 does not exist
The authenticity of host '192.168.45.129 (192.168.45.129)' can't be established.
RSA key fingerprint is SHA256:/0BrA93QVj1Sk4ndJVrRHtdPN3KH5lJM+pV5DwCaofE.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
```

Settings on the server:
```
ssh -G 192.168.45.129
host 192.168.45.129
user mbp151
hostname 192.168.45.129
port 22
addressfamily any
batchmode no
canonicalizefallbacklocal yes
canonicalizehostname false
checkhostip no
compression no
controlmaster false
enablesshkeysign no
clearallforwardings no
exitonforwardfailure no
fingerprinthash SHA256
forwardx11 no
forwardx11trusted no
gatewayports no
gssapiauthentication no
gssapidelegatecredentials no
hashknownhosts no
hostbasedauthentication no
identitiesonly no
kbdinteractiveauthentication yes
nohostauthenticationforlocalhost no
passwordauthentication yes
permitlocalcommand no
proxyusefdpass no
pubkeyauthentication true
requesttty auto
sessiontype default
stdinnull no
forkafterauthentication no
streamlocalbindunlink no
stricthostkeychecking ask
tcpkeepalive yes
tunnel false
verifyhostkeydns false
visualhostkey no
updatehostkeys true
enableescapecommandline no
canonicalizemaxdots 1
connectionattempts 1
forwardx11timeout 1200
numberofpasswordprompts 3
serveralivecountmax 3
serveraliveinterval 0
requiredrsasize 1024
obscurekeystroketiming yes
ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
hostkeyalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss
hostbasedacceptedalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
kexalgorithms sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
casignaturealgorithms ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
loglevel INFO
macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
securitykeyprovider internal
pubkeyacceptedalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
xauthlocation /usr/X11R6/bin/xauth
identityfile ~/.ssh/id_rsa
identityfile ~/.ssh/id_ecdsa
identityfile ~/.ssh/id_ecdsa_sk
identityfile ~/.ssh/id_ed25519
identityfile ~/.ssh/id_ed25519_sk
identityfile ~/.ssh/id_xmss
identityfile ~/.ssh/id_dsa
canonicaldomains none
globalknownhostsfile /usr/local/etc/ssh/ssh_known_hosts /usr/local/etc/ssh/ssh_known_hosts2
userknownhostsfile /Users/mbp151/.ssh/known_hosts /Users/mbp151/.ssh/known_hosts2
logverbose none
channeltimeout none
permitremoteopen any
addkeystoagent false
forwardagent no
connecttimeout none
tunneldevice any:any
canonicalizePermittedcnames none
controlpersist no
escapechar ~
ipqos af21 cs1
rekeylimit 0 0
streamlocalbindmask 0177
syslogfacility USER
```

`json` config file:

```
{
"_command": "Build with `packer build macos.json`",
"builders": [
{
"boot_wait": "2s",
"disk_size": "{{ user `disk_size` }}",
"guest_os_type": "{{ user `vmware_guest_os_type` }}",
"iso_checksum": "none",
"iso_url": "{{ user `iso_url` }}",
"output_directory": "output-{{ user `vm_name` }}-vmware-iso",
"shutdown_command": "echo '{{ user `ssh_username` }}'|sudo -S shutdown -h now",
"skip_compaction": true,
"communicator": "ssh",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_port": 22,
"ssh_timeout": "10000s",
"ssh_username": "{{ user `ssh_username` }}",
"ssh_key_exchange_algorithms": ["curve25519-sha256@libssh.org", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group14-sha1", "diffie-hellman-group1-sha1"],
"ssh_wait_timeout": "10000s",
"tools_upload_flavor": "darwin",
"type": "vmware-iso",
"vm_name": "{{ user `vm_name` }}",
"vmx_data": {
"cpuid.coresPerSocket": "1",
"ehci.present": "TRUE",
"firmware": "efi",
"hpet0.present": "TRUE",
"ich7m.present": "TRUE",
"keyboardAndMouseProfile": "macProfile",
"memsize": "{{ user `memory` }}",
"numvcpus": "{{ user `cpus` }}",
"smc.present": "TRUE",
"usb.present": "TRUE"
}
},
{
"boot_wait": "2s",
"disk_size": "{{ user `disk_size` }}",
"guest_additions_mode": "disable",
"guest_os_type": "{{ user `virtualbox_guest_os_type` }}",
"hard_drive_interface": "sata",
"iso_checksum": "none",
"iso_interface": "sata",
"iso_url": "{{ user `iso_url` }}",
"output_directory": "output-{{ user `vm_name` }}-virtualbox-iso",
"post_shutdown_delay": "1m",
"shutdown_command": "echo '{{ user `ssh_username` }}'|sudo -S shutdown -h now",
"communicator": "ssh",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_port": 22,
"ssh_username": "{{ user `ssh_username` }}",
"temporary_key_pair_type": "rsa",
"ssh_key_exchange_algorithms": ["curve25519-sha256@libssh.org", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group14-sha1", "diffie-hellman-group1-sha1"],
"ssh_wait_timeout": "10000s",
"type": "virtualbox-iso",
"vboxmanage": [
[ "modifyvm", "{{.Name}}", "--audiocontroller", "hda" ],
[ "modifyvm", "{{.Name}}", "--boot1", "dvd" ],
[ "modifyvm", "{{.Name}}", "--boot2", "disk" ],
[ "modifyvm", "{{.Name}}", "--chipset", "ich9" ],
[ "modifyvm", "{{.Name}}", "--firmware", "efi" ],
[ "modifyvm", "{{.Name}}", "--hpet", "on" ],
[ "modifyvm", "{{.Name}}", "--keyboard", "usb" ],
[ "modifyvm", "{{.Name}}", "--memory", "{{ user `memory` }}" ],
[ "modifyvm", "{{.Name}}", "--mouse", "usbtablet" ],
[ "modifyvm", "{{.Name}}", "--vram", "128" ]
],
"vm_name": "{{ user `vm_name` }}"
},
{
"boot_wait": "5s",
"disk_size": "{{ user `disk_size` }}",
"guest_os_type": "{{ user `parallels_guest_os_type` }}",
"iso_checksum": "none",
"iso_url": "{{ user `iso_url` }}",
"output_directory": "output-{{ user `vm_name` }}-parallels-iso",
"parallels_tools_flavor": "mac",
"prlctl": [
[ "set", "{{.Name}}", "--memsize", "{{ user `memory` }}" ],
[ "set", "{{.Name}}", "--memquota", "512:{{ user `memory` }}" ],
[ "set", "{{.Name}}", "--cpus", "{{ user `cpus` }}" ],
[ "set", "{{.Name}}", "--distribution", "macosx" ],
[ "set", "{{.Name}}", "--3d-accelerate", "highest" ],
[ "set", "{{.Name}}", "--high-resolution", "off" ],
[ "set", "{{.Name}}", "--auto-share-camera", "off" ],
[ "set", "{{.Name}}", "--auto-share-bluetooth", "off" ],
[ "set", "{{.Name}}", "--on-window-close", "keep-running" ],
[ "set", "{{.Name}}", "--isolate-vm", "off" ],
[ "set", "{{.Name}}", "--shf-host", "off" ]
],
"shutdown_command": "echo '{{ user `ssh_username` }}'|sudo -S shutdown -h now",
"communicator": "ssh",
"ssh_password": "{{ user `ssh_password` }}",
"ssh_port": 22,
"temporary_key_pair_type": "rsa",
"ssh_key_exchange_algorithms": ["curve25519-sha256@libssh.org", "ecdh-sha2-nistp256", "ecdh-sha2-nistp384", "ecdh-sha2-nistp521", "diffie-hellman-group14-sha1", "diffie-hellman-group1-sha1"],
"ssh_username": "{{ user `ssh_username` }}",
"ssh_wait_timeout": "10000s",
"type": "parallels-iso",
"vm_name": "{{ user `vm_name` }}"
}
],
"post-processors": [
{
"keep_input_artifact": false,
"output": "box/{{.Provider}}/{{user `vm_name`}}-{{user `version`}}.box",
"type": "vagrant",
"vagrantfile_template": "{{ user `vagrantfile_template` }}"
}
],
"provisioners": [
{
"destination": "/private/tmp/set_kcpassword.py",
"source": "script/support/set_kcpassword.py",
"type": "file"
},
{
"environment_vars": [
"AUTOLOGIN={{user `autologin`}}",
"PACKER_LOG=1",
"PACKER_LOG_PATH='../packerlog.txt'",
"UPDATE={{user `update`}}",
"INSTALL_XCODE_CLI_TOOLS={{user `install_xcode_cli_tools`}}",
"INSTALL_VAGRANT_KEYS={{user `install_vagrant_keys`}}",
"SSH_USERNAME={{ user `ssh_username` }}",
"SSH_PASSWORD={{ user `ssh_password` }}"
],
"execute_command": "chmod +x {{ .Path }}; env {{ .Vars }} sudo -E -S bash -vx '{{ .Path }}'",
"expect_disconnect": true,
"scripts": [
"script/vagrant.sh",
"script/vmware.sh",
"script/parallels.sh",
"script/xcode-cli-tools.sh",
"script/add-network-interface-detection.sh",
"script/energy.sh",
"script/autologin.sh",
"script/update.sh",
"script/update.sh",
"script/update.sh",
"script/update.sh"
],
"type": "shell"
},
{
"environment_vars": [
"AUTOLOGIN={{user `autologin`}}",
"PACKER_LOG=1",
"PACKER_LOG_PATH='../packerlog.txt'",
"UPDATE={{user `update`}}",
"INSTALL_XCODE_CLI_TOOLS={{user `install_xcode_cli_tools`}}",
"INSTALL_VAGRANT_KEYS={{user `install_vagrant_keys`}}",
"SSH_USERNAME={{ user `ssh_username` }}",
"SSH_PASSWORD={{ user `ssh_password` }}"
],
"execute_command": "chmod +x {{ .Path }}; env {{ .Vars }} sudo -E -S bash -vx '{{ .Path }}'",
"expect_disconnect": true,
"scripts": [
"script/minimize.sh"
],
"start_retry_timeout": "10000s",
"type": "shell"
}
],
"variables": {
"autologin": "true",
"cpus": "1",
"disk_size": "65536",
"install_vagrant_keys": "true",
"install_xcode_cli_tools": "true",
"iso_url": "dmg/OSX_InstallESD_10.9.5_13F34.dmg",
"memory": "2048",
"parallels_guest_os_type": "win-8",
"communicator": "ssh",
"ssh_password": "vagrant",
"ssh_username": "vagrant",
"update": "true",
"vagrantfile_template": "",
"version": "0.1.0",
"vm_name": "macos109",
"virtualbox_guest_os_type": "MacOS109_64",
"vmware_guest_os_type": "darwin13-64"
}
}
```
macos109.json:
```
{
"_comment": "Build with `packer build -var-file=macos109.json macos.json`",
"vm_name": "macos109",
"desktop": "true",
"cpus": "1",
"disk_size": "32000",
"iso_url": "dmg/OSX_InstallESD_10.9.5_13F34.dmg",
"memory": "2048",
"parallels_guest_os_type": "win-8",
"vagrantfile_template": "tpl/vagrantfile-macos109.tpl",
"virtualbox_guest_os_type": "MacOS109_64",
"vmware_guest_os_type": "darwin13-64"
}
```

vagrantfile-macos109.tpl file:
```
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
config.vm.define "vagrant-macos109"
config.vm.box = "macos109"

config.vm.provider :virtualbox do |v, override|
v.gui = true
v.customize ["modifyvm", :id, "--audiocontroller", "hda"]
v.customize ["modifyvm", :id, "--boot1", "dvd"]
v.customize ["modifyvm", :id, "--boot2", "disk"]
v.customize ["modifyvm", :id, "--chipset", "ich9"]
v.customize ["modifyvm", :id, "--firmware", "efi"]
v.customize ["modifyvm", :id, "--hpet", "on"]
v.customize ["modifyvm", :id, "--keyboard", "usb"]
v.customize ["modifyvm", :id, "--memory", "2048"]
v.customize ["modifyvm", :id, "--mouse", "usbtablet"]
v.customize ["modifyvm", :id, "--vram", "128"]
end

["vmware_fusion", "vmware_workstation"].each do |provider|
config.vm.provider provider do |v, override|
v.gui = true
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "1"
v.vmx["firmware"] = "efi"
v.vmx["keyboardAndMouseProfile"] = "macProfile"
v.vmx["smc.present"] = "TRUE"
v.vmx["hpet0.present"] = "TRUE"
v.vmx["ich7m.present"] = "TRUE"
v.vmx["ehci.present"] = "TRUE"
v.vmx["usb.present"] = "TRUE"
v.vmx["scsi0.virtualDev"] = "lsilogic"
end
end

config.vm.provider :parallels do |v, override|
v.customize ["set", :id, "--memsize", "2048"]
v.customize ["set", :id, "--memquota", "512:2048"]
v.customize ["set", :id, "--cpus", "2"]
v.customize ["set", :id, "--distribution", "macosx"]
v.customize ["set", :id, "--3d-accelerate", "highest"]
v.customize ["set", :id, "--high-resolution", "off"]
v.customize ["set", :id, "--auto-share-camera", "off"]
v.customize ["set", :id, "--auto-share-bluetooth", "off"]
v.customize ["set", :id, "--on-window-close", "keep-running"]
v.customize ["set", :id, "--isolate-vm", "off"]
v.customize ["set", :id, "--shf-host", "off"]
end
end
```
Configuration options:
```
PACKER_LOG_PATH="./packer.log" \
PACKER_LOG=1 packer build \
-only=vmware-iso \
-var-file=macos109.json \
-var 'install_vagrant_keys=true' \
-var 'autologin=true' \
-var 'update=true' \
-var 'install_xcode_cli_tools=true' \
-var 'ssh_username=vagrant' \
-var 'ssh_password=vagrant' \
macos.json
```

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with the supplied `packer build macos.json` configuration, focusing on the `vmware-iso` and `virtualbox-iso` builders and the SSH verbose output. No source file or test is named; done would require identifying the cause of the handshake EOF and demonstrating a successful SSH connection or a clearly scoped fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.