Vagrant stuck connection timeout retrying
I solved this problem, and will answer in case anyone else has a similar issue.
What I did was: I enabled the GUI of Virtual box to see that it was waiting for input on startup to select whether I wanted to boot directly to ubuntu or safemode etc.
To turn on the GUI you have to put this in your vagrant config Vagrantfile
:
config.vm.provider :virtualbox do |vb|
vb.gui = true
end
When you are stuck with your vagrant machine the way described above there is no need to boot in gui mode (and is impossible without an X server).
While your VM is booting, in a separate terminal window, just find out the id of the running machine.
vboxmanage list runningvms
This will result in something like this:
"projects_1234567890" {5cxxxx-cxxx-4xxx-8xxx-5xxxxxxxxxx}
Quite often, the VM is simply waiting for you to select an option in the bootloader. You can send the appropriate keycode (in the case, Enter) to the vm with controlvm
:
vboxmanage controlvm projects_1234567890 keyboardputscancode 1c
That's it. Your virtual machine will continue the boot process.
The solution I've found is to check the cable connection option in the adapter 1 which is attached to NAT. I really don't know, this is my 4th vagrant box but this is the only one with cable connection option not checked, and upon checking it, it works.
One thing to double check is if Hardware Virtualisation is enabled in your machine's BIOS.
My problem is the same string of timeouts but I could only see a black screen in the GUI.
A laptop which I was just setting up kept showing the same problem. After hours of searching I finally found a tip to see if the BIOS had Hardware Virtualisation was enabled.
Here's the content of the post I found:
I see there are still some users who are experiencing this issue. So, I will attempt to summarise a list below of some possible solutions to the SSH timeout problem:
- Make sure your firewall or antivirus is not blocking the program (which I doubt will happen often)
- Give your vagrant machine some time for timeouts to happen. If you dont have a very fast PC / Mac, the VM will take while to boot into an SSH ready state, so timeouts will happen.
- Therefore, first try to let vagrant timeout COMPLETELY before concluding that there is a fault.
- If vagrant times out completely then increase the timeout limit in the vagrant file to a few min and try again.
- If that still doesnt work, then try to clean boot your vagrant machine through the VirtualBox interface and enable the GUI of the machine beforehand. If the GUI doesn't show anything happening (ie. just blackscreen, no text) while it is booting, then your vagrant machine has got problems.
- Destroy the entire machine through the VB interface and reinstall.
- Delete the ubuntu image files in the Vagrant Images folder in the user folder and redownload and install.
- Do you even have an intel processor that supports 64bit hardware virtualisation? Google it. If you do, make sure there is no setting in your Bios disabling this feature.
- Disable hyper-v feature if you are running windows 7 or 8. Google how to disable.
- Make sure you are running through an SSH enabled client. Use Git bash. Download: http://git-scm.com/downloads
- Install a 32bit version of ubuntu like trusty32 or precise32. Just change the version in the vagrant file and reinstall vagrant in new directory.
- Make sure you are using the latest vagrant and virtualbox versions. Last resorts: Format your computer, reinstall windows and buy an intel core isomething processor.
Hope that helps.