SSH handshake error

86 views
Skip to first unread message

Danny Fournier

unread,
Jan 24, 2019, 2:36:18 PM1/24/19
to Packer
I'm attempting to create a new Ubuntu 16.04.5 VM. It's creating the VM fine as I can log into it until SSH timeouts and the VM is taken down and destroyed.

In this specific case, my goal is a VM with no new user, I know the root password and it gets assigned a static IP. This is to replicate what I get from my VPS provider and will enable me to test my Ansible scripts appropriately.

I'm noting in the preseed.cfg file, the assigning of static IP, root password and the late_command string that enables remote root login (my Ansible script turns this off when it runs).

Here is the reoccurring errors in my log file:

2019/01/24 07:45:52 packer.exe: 2019/01/24 07:45:52 [INFO] Attempting SSH connection...
2019/01/24 07:45:52 packer.exe: 2019/01/24 07:45:52 [DEBUG] reconnecting to TCP connection for SSH
2019/01/24 07:45:52 packer.exe: 2019/01/24 07:45:52 [DEBUG] handshaking with SSH
2019/01/24 07:45:55 packer.exe: 2019/01/24 07:45:55 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
2019/01/24 07:45:55 packer.exe: 2019/01/24 07:45:55 [DEBUG] Detected authentication error. Increasing handshake attempts.
packerlog.txt
ubuntu.json
preseed.cfg

Rickard von Essen

unread,
Jan 25, 2019, 2:58:18 AM1/25/19
to packe...@googlegroups.com
If you are using static ip's you need to set ssh_host to the IP you assigned. 


PS. A word of advice is that it's much simpler to use dhcp for Packer.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/509af80a-3a97-4fab-b47a-52e73a60b3ba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Fournier

unread,
Jan 25, 2019, 8:59:34 AM1/25/19
to packe...@googlegroups.com
I tried using the IP I set. However, the IP I set in the preseed isn't what ifconfig will display. I set 192.*, but end up with 10.*. 

IIRC, NAT is used initially in Virtualbox which explains the 10.*? If I use the 10.* in Packer, it doesn't work either, probably due to NAT and the VM not being accessible in that way?

Either that or I have a bad preseed file in terms of networking, DHCP...


You received this message because you are subscribed to a topic in the Google Groups "Packer" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/packer-tool/OZx8j6MwNNA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to packer-tool...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt-1dNO5iU_TgwqcYw9jf7sSMdtJnh9%3D-2zyrDYCQwd2cg%40mail.gmail.com.

Rickard von Essen

unread,
Jan 25, 2019, 9:07:31 AM1/25/19
to packe...@googlegroups.com
You can find working packer templates here that you can base yours on:

Danny Fournier

unread,
Jan 26, 2019, 9:56:50 AM1/26/19
to Packer
The Bento files worked out fine. I didn't get errors. Clearly something wrong with my preseed or way of doing things.

For the limited time I was able to work with the VM, until SSH timed out, I was able to confirm that the network settings did not match what I have in my preseed file. Not sure what this means.

Perhaps I should be looking at alternatives.

Rickard von Essen

unread,
Jan 26, 2019, 11:20:34 AM1/26/19
to packe...@googlegroups.com
If you run the build wit -on-error=ask you will have unlimited time to poke around and check te network etc. 

Danny Fournier

unread,
Jan 27, 2019, 8:06:08 AM1/27/19
to Packer
Thanks for the tip!

Once it failed, I chose to keep all artifacts and restarted the VM. Network was NAT, IP was 10.*, the same it was before restarting.

I swapped out networking for bridged mode, the IP became 192.168.2.16. The problem, my preseed file has .36. Also, all the other VMs I built, seem to use the network interface: enp0s3. This one uses eth0. No idea if this matters.
Reply all
Reply to author
Forward
0 new messages