I'm running 0.4.0 on Mac OSX 10.6.8. I'm using amazon-ebs. The machine is created with a public IP and my security group, and then fails with "Timeout waiting for SSH." I tried disabling the firewall on my workstation and extending the ssh timeout to 2 minutes. Anyone know what might be wrong? -- Thanks
This is my template file
{
"builders": [{
"type": "amazon-ebs",
"access_key": "",
"secret_key": "",
"security_group_id": "sg-xxxxxxx",
"region": "us-west-2",
"source_ami": "ami-xxxxxxx",
"instance_type": "t1.micro",
"ssh_username": "user",
"ami_name": "packer-example {{timestamp}}"
}]
}
Debug output:
2013/11/22 15:18:52 ui: ==> amazon-ebs: Waiting for instance (i-007bd637) to become ready...
2013/11/22 15:18:52 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:18:52 Waiting for state to become: running
2013/11/22 15:19:12 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:12 Waiting for SSH, up to timeout: 1m0s
==> amazon-ebs: Waiting for SSH to become available...
2013/11/22 15:19:12 ui: ==> amazon-ebs: Waiting for SSH to become available...
2013/11/22 15:19:17 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:17 Opening conn for SSH to tcp ec2-54-201-92-111.us-west-2.compute.amazonaws.com:22
2013/11/22 15:19:32 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:32 TCP connection to SSH ip/port failed: dial tcp 54.201.92.111:22: i/o timeout
2013/11/22 15:19:37 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:37 Opening conn for SSH to tcp ec2-54-201-92-111.us-west-2.compute.amazonaws.com:22
2013/11/22 15:19:48 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:48 TCP connection to SSH ip/port failed: dial tcp 54.201.92.111:22: connection refused
2013/11/22 15:19:53 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:53 Opening conn for SSH to tcp ec2-54-201-92-111.us-west-2.compute.amazonaws.com:22
2013/11/22 15:19:53 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:53 TCP connection to SSH ip/port failed: dial tcp 54.201.92.111:22: connection refused
2013/11/22 15:19:59 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:59 Opening conn for SSH to tcp ec2-54-201-92-111.us-west-2.compute.amazonaws.com:22
2013/11/22 15:19:59 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:19:59 TCP connection to SSH ip/port failed: dial tcp 54.201.92.111:22: connection refused
2013/11/22 15:20:04 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:20:04 Opening conn for SSH to tcp ec2-54-201-92-111.us-west-2.compute.amazonaws.com:22
2013/11/22 15:20:04 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:20:04 TCP connection to SSH ip/port failed: dial tcp 54.201.92.111:22: connection refused
2013/11/22 15:20:09 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:20:09 Opening conn for SSH to tcp ec2-54-201-92-111.us-west-2.compute.amazonaws.com:22
2013/11/22 15:20:09 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:20:09 TCP connection to SSH ip/port failed: dial tcp 54.201.92.111:22: connection refused
==> amazon-ebs: Timeout waiting for SSH.
2013/11/22 15:20:12 ui error: ==> amazon-ebs: Timeout waiting for SSH.
2013/11/22 15:20:12 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:20:12 SSH wait cancelled. Exiting loop.
==> amazon-ebs: Terminating the source AWS instance...
2013/11/22 15:20:12 ui: ==> amazon-ebs: Terminating the source AWS instance...
2013/11/22 15:20:13 /Users/user/packer/packer-builder-amazon-ebs: 2013/11/22 15:20:13 Waiting for state to become: terminated
==> amazon-ebs: Deleting temporary keypair...
2013/11/22 15:20:51 ui: ==> amazon-ebs: Deleting temporary keypair...
Build 'amazon-ebs' errored: Timeout waiting for SSH.
2013/11/22 15:20:52 ui error: Build 'amazon-ebs' errored: Timeout waiting for SSH.
2013/11/22 15:20:52 /Users/user/packer/packer-command-build: 2013/11/22 15:20:52 Builds completed. Waiting on interrupt barrier...
2013/11/22 15:20:52 machine readable: error-count []string{"1"}
==> Some builds didn't complete successfully and had errors:
2013/11/22 15:20:52 ui error:
==> Some builds didn't complete successfully and had errors:
2013/11/22 15:20:52 machine readable: amazon-ebs,error []string{"Timeout waiting for SSH."}
--> amazon-ebs: Timeout waiting for SSH.
2013/11/22 15:20:52 ui error: --> amazon-ebs: Timeout waiting for SSH.
==> Builds finished but no artifacts were created.
Based on the "connection refused" errors I would check your security group to make sure it can allow connections from your host running Packer. This doesn't look like a Packer bug.
Thanks for the response. That was one of the first things I checked. I'm using the same security group I use to ssh into my other dev boxes in aws. Once the instance was spawned by packer I was able to validate that the new instance was using the security group I had assigned to it.
Great, I would run Packer with -debug
mode so that you can pause it. Then try to SSH in yourself and see if you can get through to it. In debug mode, Packer will tell you the address of the machine.
The "connection refused" error is pretty clear cut: it can't establish a TCP connection to the IP/port of the machine.
Could it be the temporary key that's generated? I'm not sure how that works, since my local account won't have the key installed, unless packer handles that in the background. I didn't see a template config variable to add the key I normally used.
Based on the error, it isn't even reaching the SSH handshake.
OK, thanks. I'll do some more debugging.
I'm experiencing this error too: https://gist.github.com/jodosha/bd85946ce85e6fcc5cb6
Basically, when packer tries to ssh into the VM, a VBox window pop ups and shows the Ubuntu setup screen. That's why the handshake fails. I've also tried with VMware and/or using a simple shell provisioning but the error it's always the same.
@jodosha Looks like you're missing a boot command to tell Packer how to install it.
@mitchellh thanks, this unlocked the timeout problem.
Two feedbacks from my first impression:
"boot_command"
option, by looking at the getting started article I didn't noticed it.@jodosha :+1: I think a repo of boot commands would be really helpful.
+1 Having the same ssh timeout error and I'm using the example on the get started guide
@levinotik I didn't succeeded to provision a Debian 7.3 VM, first trying to follow the getting started guide and then, by applying a boot_command of a blog post I've found around on the internet. I gave up :(
This article looks promising: http://blog.codeship.io/2013/11/07/building-vagrant-machines-with-packer.html @mitchellh tweeted about it.
I had similar issues when using packer on a windows host. See here: http://unix.stackexchange.com/questions/110714/kickstart-is-frozen-at-100
+1 on having the ssh timeout error using example on the get started guide.
+1 on having ssh timeout error as well; I resolved by using debug and waiting a while (til I could ssh to it from another console); then let it try to ssh to that box.
+1
Packer v0.5.2 (on Linux386)
On virtualbox-iso I always get:
==> virtualbox-iso: Timeout waiting for SSH.
Increasing "ssh_wait_timeout" does not solve it. Enabling PACKER_LOG does not generate extra output.
On amazon-ebs shows up ramdom errors:
Even I got it to run correctly randomly sometimes.
I run into the same error if I try to enable bridged networking:
["modifyvm", "{{.Name}}", "--nic1", "bridged", "--bridgeadapter1", "en0"]
I can login through the console as the vagrant user and hostname -I
to grab the guest ip, which I can use to ssh in fine with ssh vagrant@ip
from my terminal.
I feel like I must be misunderstanding something about the way packer/virtualbox handles the networking.
If I try ssh vagrant@localhost -p 3499
the connection is refused.
==> virtualbox-ovf: Creating forwarded port mapping for SSH (host port 3499)
==> virtualbox-ovf: Executing custom VBoxManage commands...
virtualbox-ovf: Executing: modifyvm image --nic1 bridged --bridgeadapter1 en0
==> virtualbox-ovf: Starting the virtual machine...
==> virtualbox-ovf: Waiting 10s for boot...
==> virtualbox-ovf: Waiting for SSH to become available...
==> virtualbox-ovf: Timeout waiting for SSH.
No ssh attempts by packer are logged in /var/log/auth.log
. What am I missing?
+1 Having this issue as well using http://releases.ubuntu.com/12.04/ubuntu-12.04.4-server-amd64.iso
I had this error with the OpenStack builder and simply specifying
"use_floating_ip": true,
"floating_ip_pool": "public",
fixed it for me.
Having this problem too. Did anyone resolve it?
I am using VirtualBox to create Vagrant boxes. I ran into the ssh handshake issue.
One of the issues I ran into was the ssh user in the builder config and the preseed.cfg were different. Upon addressing it packer proceeded forward.
On Amazon with the ebs builder I solved it by looking more closely that my security group was indeed too strict.
Does anybody have any guidance on how to create a preseed file for Ubuntu 15.04 desktop?
It is getting stuck at:
==> virtualbox-iso: Waiting for SSH to become available...
due to a Welcome menu popping up
@d3netxer See https://github.com/chef/bento or https://github.com/boxcutter for great examples and of course https://help.ubuntu.com/14.10/installation-guide/en.i386/apb.html
Questions should be handled in IRC or in the Google Group, see http://packer.io/community
mitchellh commented on Nov 22, 2013
Great, I would run Packer with -debug mode so that you can pause it. Then try to SSH in yourself and see if you can get through to it. In debug mode, Packer will tell you the address of the machine.
The "connection refused" error is pretty clear cut: it can't establish a TCP connection to the IP/port of the machine.
ftw. :D thanks
Im getting the same issue... Monitoring the instance during that process, shows that the inital build/install takes more than 15minutes and SSH wont wait that long. Took me a few hours to figure that out and find the "ssh_wait_timeout" option for the builders json config. Im using it on windows 10 with virtualbox5, vagrant 1.7x and a ubuntu instance to build from scratch... that not happing within 30seconds :)
Documenting the "ssh_wait_timeout" ie in the Examples would be very helpful.
I had this issue with the virtualbox-ovf provider and a CentOS 7 image. By default it was putting the VM into bridged network mode. The fix was to do:
["modifyvm", "{{.Name}}", "--nic1", "nat"
I am having this problem with OpenStack. Tried nickcarenza's solution but to no luck. Running the debug gets to "StepAllocateIP" then detects the ip address of the instance and try to connect to it ending in a TCP connection to SSH ip/port failed: dial tcp ip.address.of.instance:port: i/o timeout.
Ive tried to ssh into it whilst it is paused but my ssh returns a blank line after executing.
In the console of openstack it displays the following screen (
)
I don't quite think mine is leaving the creation stage properly.
@willseaford Could you post to the mailing list with all the details ask for in the issue template.
@rickard-von-essen Sorry, I can't find a mailing list, do you possibly mean make a new post in the issue log?
See https://www.packer.io/community/
The mail list is preferred since this is most likely not a bug.
If you have got to this point, skimming the thread for the most likely or fitting answer to most quickly fix your set up, do try adding
"ssh_wait_timeout": "10000s",
to your builders section in the json packer file. At least it worked for me. I found it here
https://blog.codeship.com/packer-vagrant-tutorial/
to help troubleshoot in AWS try going to the instance in the UI
Actions -> Instance Settings -> Get system log
ssh might fail if the instance failed to boot cleanly.
In my case it was due to volume mounting errors.
@phosphre
the ssh_wait_timeout flag has been changed to ssh_timeout
https://www.packer.io/docs/templates/communicator.html#ssh_timeout
Hi @jodosha Could please suggest me the boot command. I'm also facing the same Issue.
ERROR * Waiting for SSH to become available...
*errored: Timeout waiting for SSH
Although IP has been assigned to the VM.
Pleaase suggent the boot_command for Ubuntu 18.04
@sukhkar I'm sorry but that was a problem solved during an experiment to use Packer. I don't have that command anymore.
Use the mailing list for usage help and troubleshoot. See comment above.
Most helpful comment
If you have got to this point, skimming the thread for the most likely or fitting answer to most quickly fix your set up, do try adding
"ssh_wait_timeout": "10000s",
to your builders section in the json packer file. At least it worked for me. I found it here
https://blog.codeship.com/packer-vagrant-tutorial/