Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vagrant stuck connection timeout retrying

My vagrant was working perfectly fine last night. I've just turned the PC on, hit vagrant up, and this is what I get:

==> default: Clearing any previously set network interfaces... ==> default: Preparing network interfaces based on configuration...     default: Adapter 1: nat     default: Adapter 2: hostonly ==> default: Forwarding ports...     default: 22 => 2222 (adapter 1) ==> default: Booting VM... ==> default: Waiting for machine to boot. This may take a few minutes...     default: SSH address: 127.0.0.1:2222     default: SSH username: vagrant     default: SSH auth method: private key     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying...     default: Error: Connection timeout. Retrying... 

Has anyone had this before? vagrant isn't widely covered on the web yet and I can't find a reason why this is occurring.

like image 970
Kiee Avatar asked Mar 22 '14 08:03

Kiee


2 Answers

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 
like image 113
Kiee Avatar answered Oct 09 '22 11:10

Kiee


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.

like image 35
harrie Avatar answered Oct 09 '22 11:10

harrie