{"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":[{"url":"https://api.github.com/repos/docker/machine/labels/area/driver-virtualbox","name":"area/driver-virtualbox","color":"bfdadc"},{"url":"https://api.github.com/repos/docker/machine/labels/kind/bug","name":"kind/bug","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":43,"created_at":"2015-04-20T10:47:39Z","updated_at":"2015-08-05T10:57:16Z","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/127955095","html_url":"https://github.com/docker/machine/issues/1031#issuecomment-127955095","issue_url":"https://api.github.com/repos/docker/machine/issues/1031","id":127955095,"user":{"login":"manik2131","id":9436422,"avatar_url":"https://avatars.githubusercontent.com/u/9436422?v=3","gravatar_id":"","url":"https://api.github.com/users/manik2131","html_url":"https://github.com/manik2131","followers_url":"https://api.github.com/users/manik2131/followers","following_url":"https://api.github.com/users/manik2131/following{/other_user}","gists_url":"https://api.github.com/users/manik2131/gists{/gist_id}","starred_url":"https://api.github.com/users/manik2131/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manik2131/subscriptions","organizations_url":"https://api.github.com/users/manik2131/orgs","repos_url":"https://api.github.com/users/manik2131/repos","events_url":"https://api.github.com/users/manik2131/events{/privacy}","received_events_url":"https://api.github.com/users/manik2131/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T10:57:16Z","updated_at":"2015-08-05T10:57:16Z","body":"Also when I print the manik221.vbox machine then ,, I got to know that it is creating in the localhost..by giving the below output...\r\n\r\nroot@m1023019:~/.docker/machine/machines# ls\r\ndev  dev1  dev2  local  manik  manik112  manik221  sharma\r\nroot@m1023019:~/.docker/machine/machines# cd manik221/\r\nroot@m1023019:~/.docker/machine/machines/manik221# ls\r\nboot2docker.iso  config.json  disk.vmdk  id_rsa  id_rsa.pub  manik221\r\nroot@m1023019:~/.docker/machine/machines/manik221# cd manik221/\r\nroot@m1023019:~/.docker/machine/machines/manik221/manik221# ls\r\nLogs  manik221.vbox  manik221.vbox-prev\r\nroot@m1023019:~/.docker/machine/machines/manik221/manik221# cat manik221.vbox\r\n<?xml version=\"1.0\"?>\r\n<!--\r\n** DO NOT EDIT THIS FILE.\r\n** If you make changes to this file while any VirtualBox related application\r\n** is running, your changes will be overwritten later, without taking effect.\r\n** Use VBoxManage or the VirtualBox Manager GUI to make changes.\r\n-->\r\n<VirtualBox xmlns=\"http://www.innotek.de/VirtualBox-settings\" version=\"1.12-linux\">\r\n  <Machine uuid=\"{760c0375-f32a-4327-b04b-5a45d5802527}\" name=\"manik221\" OSType=\"Linux26_64\" snapshotFolder=\"Snapshots\" lastStateChange=\"2015-08-05T09:34:00Z\">\r\n    <MediaRegistry>\r\n      <HardDisks>\r\n        <HardDisk uuid=\"{12f600c7-e9bb-4faa-96f6-146993e592db}\" location=\"/root/.docker/machine/machines/manik221/disk.vmdk\" format=\"VMDK\" type=\"Normal\"/>\r\n      </HardDisks>\r\n      <DVDImages>\r\n        <Image uuid=\"{c332199c-1773-4d7e-a735-8f8f062246d5}\" location=\"/root/.docker/machine/machines/manik221/boot2docker.iso\"/>\r\n      </DVDImages>\r\n      <FloppyImages/>\r\n    </MediaRegistry>\r\n    <Hardware version=\"2\">\r\n      <CPU count=\"1\" hotplug=\"false\">\r\n        <HardwareVirtEx enabled=\"true\" exclusive=\"true\"/>\r\n        <HardwareVirtExNestedPaging enabled=\"true\"/>\r\n        <HardwareVirtExVPID enabled=\"true\"/>\r\n        <PAE enabled=\"true\"/>\r\n        <HardwareVirtExLargePages enabled=\"true\"/>\r\n        <HardwareVirtForce enabled=\"false\"/>\r\n      </CPU>\r\n      <Memory RAMSize=\"1024\" PageFusion=\"false\"/>\r\n      <HID Pointing=\"PS2Mouse\" Keyboard=\"PS2Keyboard\"/>\r\n      <HPET enabled=\"true\"/>\r\n      <Chipset type=\"PIIX3\"/>\r\n      <Boot>\r\n        <Order position=\"1\" device=\"DVD\"/>\r\n        <Order position=\"2\" device=\"DVD\"/>\r\n        <Order position=\"3\" device=\"HardDisk\"/>\r\n        <Order position=\"4\" device=\"None\"/>\r\n      </Boot>\r\n      <Display VRAMSize=\"8\" monitorCount=\"1\" accelerate3D=\"false\" accelerate2DVideo=\"false\"/>\r\n      <RemoteDisplay enabled=\"false\" authType=\"Null\"/>\r\n      <BIOS>\r\n        <ACPI enabled=\"true\"/>\r\n        <IOAPIC enabled=\"true\"/>\r\n        <Logo fadeIn=\"false\" fadeOut=\"false\" displayTime=\"0\"/>\r\n        <BootMenu mode=\"Disabled\"/>\r\n        <TimeOffset value=\"0\"/>\r\n        <PXEDebug enabled=\"false\"/>\r\n      </BIOS>\r\n      <USBController enabled=\"false\" enabledEhci=\"false\"/>\r\n      <Network>\r\n        <Adapter slot=\"0\" enabled=\"true\" MACAddress=\"080027002661\" cable=\"true\" speed=\"0\" type=\"82540EM\">\r\n          <DisabledModes/>\r\n          <NAT>\r\n            <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n            <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            <Forwarding name=\"ssh\" proto=\"1\" hostip=\"127.0.0.1\" hostport=\"33655\" guestport=\"22\"/>\r\n          </NAT>\r\n        </Adapter>\r\n        <Adapter slot=\"1\" enabled=\"true\" MACAddress=\"08002714E5BB\" cable=\"true\" speed=\"0\" type=\"82540EM\">\r\n          <DisabledModes>\r\n            <NAT>\r\n              <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n              <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            </NAT>\r\n            <HostOnlyInterface name=\"vboxnet0\"/>\r\n          </DisabledModes>\r\n          <HostOnlyInterface name=\"vboxnet0\"/>\r\n        </Adapter>\r\n        <Adapter slot=\"2\" enabled=\"false\" MACAddress=\"08002794DA5C\" cable=\"true\" speed=\"0\" type=\"Am79C973\">\r\n          <DisabledModes>\r\n            <NAT>\r\n              <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n              <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            </NAT>\r\n          </DisabledModes>\r\n        </Adapter>\r\n        <Adapter slot=\"3\" enabled=\"false\" MACAddress=\"080027779F38\" cable=\"true\" speed=\"0\" type=\"Am79C973\">\r\n          <DisabledModes>\r\n            <NAT>\r\n              <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n              <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            </NAT>\r\n          </DisabledModes>\r\n        </Adapter>\r\n        <Adapter slot=\"4\" enabled=\"false\" MACAddress=\"08002748CDB9\" cable=\"true\" speed=\"0\" type=\"Am79C973\">\r\n          <DisabledModes>\r\n            <NAT>\r\n              <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n              <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            </NAT>\r\n          </DisabledModes>\r\n        </Adapter>\r\n        <Adapter slot=\"5\" enabled=\"false\" MACAddress=\"0800279EC3EE\" cable=\"true\" speed=\"0\" type=\"Am79C973\">\r\n          <DisabledModes>\r\n            <NAT>\r\n              <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n              <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            </NAT>\r\n          </DisabledModes>\r\n        </Adapter>\r\n        <Adapter slot=\"6\" enabled=\"false\" MACAddress=\"0800276D63FB\" cable=\"true\" speed=\"0\" type=\"Am79C973\">\r\n          <DisabledModes>\r\n            <NAT>\r\n              <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n              <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            </NAT>\r\n          </DisabledModes>\r\n        </Adapter>\r\n        <Adapter slot=\"7\" enabled=\"false\" MACAddress=\"0800278D7096\" cable=\"true\" speed=\"0\" type=\"Am79C973\">\r\n          <DisabledModes>\r\n            <NAT>\r\n              <DNS pass-domain=\"true\" use-proxy=\"false\" use-host-resolver=\"false\"/>\r\n              <Alias logging=\"false\" proxy-only=\"false\" use-same-ports=\"false\"/>\r\n            </NAT>\r\n          </DisabledModes>\r\n        </Adapter>\r\n      </Network>\r\n      <UART>\r\n        <Port slot=\"0\" enabled=\"false\" IOBase=\"0x3f8\" IRQ=\"4\" hostMode=\"Disconnected\"/>\r\n        <Port slot=\"1\" enabled=\"false\" IOBase=\"0x3f8\" IRQ=\"4\" hostMode=\"Disconnected\"/>\r\n      </UART>\r\n      <LPT>\r\n        <Port slot=\"0\" enabled=\"false\" IOBase=\"0x378\" IRQ=\"4\"/>\r\n        <Port slot=\"1\" enabled=\"false\" IOBase=\"0x378\" IRQ=\"4\"/>\r\n      </LPT>\r\n      <AudioAdapter controller=\"AC97\" driver=\"Pulse\" enabled=\"false\"/>\r\n      <RTC localOrUTC=\"UTC\"/>\r\n      <SharedFolders/>\r\n      <Clipboard mode=\"Bidirectional\"/>\r\n      <IO>\r\n        <IoCache enabled=\"true\" size=\"5\"/>\r\n        <BandwidthGroups/>\r\n      </IO>\r\n      <HostPci>\r\n        <Devices/>\r\n      </HostPci>\r\n      <Guest memoryBalloonSize=\"0\"/>\r\n      <GuestProperties>\r\n        <GuestProperty name=\"/VirtualBox/GuestAdd/SharedFolders/MountPrefix\" value=\"/\" timestamp=\"1438767243691931000\" flags=\"\"/>\r\n        <GuestProperty name=\"/VirtualBox/GuestAdd/SharedFolders/MountDir\" value=\"/\" timestamp=\"1438767244213999000\" flags=\"\"/>\r\n      </GuestProperties>\r\n    </Hardware>\r\n    <StorageControllers>\r\n      <StorageController name=\"SATA\" type=\"AHCI\" PortCount=\"30\" useHostIOCache=\"true\" Bootable=\"true\" IDE0MasterEmulationPort=\"0\" IDE0SlaveEmulationPort=\"1\" IDE1MasterEmulationPort=\"2\" IDE1SlaveEmulationPort=\"3\">\r\n        <AttachedDevice passthrough=\"false\" type=\"DVD\" port=\"0\" device=\"0\">\r\n          <Image uuid=\"{c332199c-1773-4d7e-a735-8f8f062246d5}\"/>\r\n        </AttachedDevice>\r\n        <AttachedDevice type=\"HardDisk\" port=\"1\" device=\"0\">\r\n          <Image uuid=\"{12f600c7-e9bb-4faa-96f6-146993e592db}\"/>\r\n        </AttachedDevice>\r\n      </StorageController>\r\n    </StorageControllers>\r\n  </Machine>\r\n</VirtualBox>\r\n"}}