{"action":"created","issue":{"url":"https://api.github.com/repos/docker/machine/issues/1031","labels_url":"https://api.github.com/repos/docker/machine/issues/1031/labels{/name}","comments_url":"https://api.github.com/repos/docker/machine/issues/1031/comments","events_url":"https://api.github.com/repos/docker/machine/issues/1031/events","html_url":"https://github.com/docker/machine/issues/1031","id":69559571,"number":1031,"title":"Another reason docker-machine create is hanging","user":{"login":"far-blue","id":344317,"avatar_url":"https://avatars.githubusercontent.com/u/344317?v=3","gravatar_id":"","url":"https://api.github.com/users/far-blue","html_url":"https://github.com/far-blue","followers_url":"https://api.github.com/users/far-blue/followers","following_url":"https://api.github.com/users/far-blue/following{/other_user}","gists_url":"https://api.github.com/users/far-blue/gists{/gist_id}","starred_url":"https://api.github.com/users/far-blue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/far-blue/subscriptions","organizations_url":"https://api.github.com/users/far-blue/orgs","repos_url":"https://api.github.com/users/far-blue/repos","events_url":"https://api.github.com/users/far-blue/events{/privacy}","received_events_url":"https://api.github.com/users/far-blue/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":32,"created_at":"2015-04-20T10:47:39Z","updated_at":"2015-07-04T06:58:29Z","closed_at":null,"body":"I'm also seeing `create` hang during the creation process with `Waiting for VM to start...`.\r\n\r\nFor me, the VM is being created fine but docker-machine never realises this and so will hang forever. In the process it also seems to take 100% cpu.\r\n\r\nI believe the problem is rooted in the ssh port forwarding. I notice in the config.json for the machine that SSHPort is 0 and if I run `docker-machine ip` with debug I see this (notice the `-p 0`):\r\n```\r\nDEBU[0000] executing: ssh -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ConnectionAttempts=30 -o LogLevel=quiet -p 0 -i /Users/rgoldsmith/.docker/machine/machines/dev/id_rsa docker@localhost ip addr show dev eth1\r\n```\r\nwhich unsurprisingly errors with: `Bad port '0'`\r\n\r\nI propose there is an issue in `getAvailableTCPPort()` that means it is returning 0 instead of an available port. Because 0 is being passed to VBoxManage it is then picking one itself. Querying VBoxManage I can see, in my case: `Forwarding(0)=\"ssh,tcp,127.0.0.1,56069,,22”)`"},"comment":{"url":"https://api.github.com/repos/docker/machine/issues/comments/118474481","html_url":"https://github.com/docker/machine/issues/1031#issuecomment-118474481","issue_url":"https://api.github.com/repos/docker/machine/issues/1031","id":118474481,"user":{"login":"arthurk","id":23406,"avatar_url":"https://avatars.githubusercontent.com/u/23406?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurk","html_url":"https://github.com/arthurk","followers_url":"https://api.github.com/users/arthurk/followers","following_url":"https://api.github.com/users/arthurk/following{/other_user}","gists_url":"https://api.github.com/users/arthurk/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurk/subscriptions","organizations_url":"https://api.github.com/users/arthurk/orgs","repos_url":"https://api.github.com/users/arthurk/repos","events_url":"https://api.github.com/users/arthurk/events{/privacy}","received_events_url":"https://api.github.com/users/arthurk/received_events","type":"User","site_admin":false},"created_at":"2015-07-04T06:58:29Z","updated_at":"2015-07-04T06:58:29Z","body":"I figured out a solution that works in my case.\r\n\r\nChecking ifconfig showed a lot of vboxnet# adapters that were used by virtual machines that are long gone, but for some reason the adapter was still holding on to its ip address:\r\n\r\n```\r\nvboxnet0: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:00\r\nvboxnet1: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:01\r\nvboxnet10: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:0a\r\n\tinet 192.168.99.1 netmask 0xffffff00 broadcast 192.168.99.255\r\nvboxnet2: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:02\r\nvboxnet3: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:03\r\nvboxnet4: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:04\r\nvboxnet5: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:05\r\nvboxnet6: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:06\r\nvboxnet7: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:07\r\nvboxnet8: flags=8842<BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500\r\n\tether 0a:00:27:00:00:08\r\n```\r\n\r\nDocker-machine wanted to create a vm with an ip in the 192.168.99.* range, but vboxnet10 was still holding on to the `192.168.99.1` address. For some reason, this made machine fail. Removing the adapter with `VBoxManage hostonlyif remove vboxnet10` fixed the issue and I can now use docker-machine successfully:\r\n\r\n```\r\ndocker-machine create --driver virtualbox finaltest\r\nCreating VirtualBox VM...\r\nCreating SSH key...\r\nStarting VirtualBox VM...\r\nStarting VM...\r\nTo see how to connect Docker to this machine, run: docker-machine env finaltest\r\n```\r\n\r\n```\r\ndocker-machine ls\r\nNAME          ACTIVE   DRIVER       STATE     URL                         SWARM\r\nanothertest            virtualbox   Running   tcp://192.168.99.101:2376\r\nfinaltest              virtualbox   Running   tcp://192.168.99.102:2376\r\ntest                   virtualbox   Running   tcp://192.168.99.100:2376\r\n```"}}