Vagrant stuck connection timeout retrying
Asked Answered
A

49

430

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.

Antonantone answered 22/3, 2014 at 8:27 Comment(4)
The situation could be because of VirtualBox failed to redirect ports, despite saying '==> default: Forwarding ports... default: 22 => 2222 (adapter 1)' You may have a look at full description in my question here link. I still have no idea how to fix redirection fail( You may have a look in VirtualBox log.Lianneliao
I have the same issue. The problem was that ssh server was not installed and enabled on guest machine.Housing
I had the same error installing ubuntu 16.04 - the issue was fixed by upgrading virtual box to 5.1.x - see askubuntu.com/a/822974/151137Elf
@Antonantone Please check the antivirus and firewall as well, stop both for time being and then u go :)Patroon
A
387

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
Antonantone answered 22/3, 2014 at 8:33 Comment(19)
What was the problem?Kehoe
@Kehoe the problem was that the virtual machine may not of shutdown properly, and when I tried SSHing into it the following day, the machine wanted me to select which mode I wanted to boot into, but via the commandline I had no idea until I turned on the gui which let me pick the mode.Antonantone
@Kiee, thanks for this. My issue was just to enable pae. The GUI did told me the problem.Ingemar
Thanks. In my case, the VM was stuck at the bootloader (grub) waiting for ENTER key. I am using the default hashicorp/precise32. I started the machine with GUI, then ran sudo grub-mkconfig that reset the /boot/grub/grub.cfg file, and I could then comment back the vb.gui=true line.Lowrance
If you are trying a 64 be sure you have enabled visualization in your setupHalden
How do access vagrant config? where does it sit?Phaedra
@Phaedra Your Vagrant file, in the directory you're (or should be) running vagrant upAntonantone
Thanks @Kiee! GUI does show what's going on. In my case is asking for: 'Homestead login' and then 'password', which I have no clue what to enter, but that's another problem.Lakenyalaker
@jasa If its a vagrant vm, there's a good chance the username and password are both vagrantAntonantone
@Antonantone yes, is 'vagrant', 'vagrant'; however, I 'resolved' the problem by turning off the wifi at first, and although, of course, this is not a good solution, I set manually my mac's IP using Google Public DNS 8.8.8.8 in the DNS pane. This last one is also only a walk-around, but works fine. This post helped me out: laravel.io/forum/…Lakenyalaker
Thanks. The GUI informed me that the guest (Ubuntu) was prompting for a login and password, which it shouldn't because it should be using ssh key authentication instead (for my configuration). I debugged by reading vagrant ssh-config and manually executing many related ssh commands, adding different ssh flags/options each time. I eventually discovered the root cause: one of my .ssh/config entries accidentally did not have Host set, thus applying that config rule to all ssh commands. Solution: make sure every .ssh/config entry has Host set.Exclusive
The GUI showed me the following error: VT-x/AMD-V hardware acceleration is not available on your system. Your 64-bit quest will fail to detect a 64-bit CPU and will not be able to bootPeignoir
Interestingly, I enabled virtualisation support from the BIOS which fixed this for me.Later
Counter-intuitively, in my BIOS, I had to disable Virtualisation and enable VT-X. Try toggling these setting in your BIOS.Polo
@Ben - Enabling Vt-x is enabling virtualization. This worked for me too.Hourglass
@Antonantone Please check the antivirus and firewall as well, stop both for time being and then u go :)Patroon
This is really useful. I was able to tell that my Ubuntu box did not shutdown properly and was stuck at a recovery mode. Thank you very much.Attaboy
Where is the vagrant file located? I am on windows 10 using virtual box 5.2 and vagrant 2.2.2Wilsonwilt
I had to do this, then press enter. that got me to a prompt. I wonder if there is a better way of handling the workaround though so the gui isn't necesary.Julian
G
217

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.

Galore answered 15/4, 2014 at 21:38 Comment(6)
@ParrisVarney: Most of the time, this hang is caused by the bootloader waiting for an entry to be selected. This is done by sending it the enter key, which you can either do using the GUI, or by using vboxmanage which the command line interface for VirtualBox. So you are "controlling" the VM and sending it a "scan code" for the Enter key (1C) using the parameter keyboardputscancode.Tortosa
This particular approach didn't work for me. The only change I've noticed is that the message output changed from default: Warning: Connection timeout. Retrying... to default: Warning: Remote connection disconnect. Retrying... after running vboxmanage controlvm dst_default_1407935479617_2464 keyboardputscancode 1c. Will try the vb.gui = true instead.Caruthers
That was the trick. It took about 30 seconds but did what was expected without needing a UI.Strachey
very nice. vboxmanage get's installed by default when you install virtualbox on ubuntu.Garrik
vboxmanage on windows is found in C:\Progra~1\Oracle\VirtualBox\VBoxManage.exe that said, the BIOS change below helped fix this issue for meSisera
It fix for the first time. If I halt the vagrant machine and up again, I have same issue.Seleneselenious
M
48

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.

Moseley answered 26/8, 2014 at 11:2 Comment(3)
Second that "check to make sure hardware virtualization is enabled". I was experiencing this exact issue, and rebooting the host then enabling virtualization in the BIOS resolved the issue fir me.Jeremiah
Just got hit by this. Hyper-V was the cause and uninstalling it fixed it. tyvmRemaremain
Counter-intuitively, in my BIOS, I had to disable Virtualisation and enable VT-X. Try toggling these setting in your BIOS.Polo
B
45

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. NAT cable connection

Bubbler answered 3/11, 2016 at 9:1 Comment(4)
I'm using Homestead 1.0.1 and VirtualBox 5.0.28 and I solved the issue thanks to this answer.Cheshire
Through the GUI I could see it was waiting on a network interface and this then solved the problem. Thank.sYamashita
This fixed mine +1Charlenacharlene
This fixed my issue: Vagrant 1.9; Virtualbox 5.1; Laravel/Homestead 5.3Sloatman
J
36

I had exact the same problem. I thought the problem might be with SSH keys (wrong localization of file or something else but I checked it many times) but you may always add in configure section username and password (without using ssh keys) and running gui so the code in Vagrantfile should look like more or less as below:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.ssh.username = "vagrant"
  config.ssh.password = "vagrant"

   config.vm.provider "virtualbox" do |vb|
     vb.gui = true
   end
end

In my case even if GUI was displayed I got black screen (no errors or possibility to login or anything else) and in console I got the Error: Connection timeout. Retrying... many times. I made sure I had VT-x (virtualization) enabled in BIOS, I checked many combinations of versions of both Virtual Box and Vagrant together and many Vagrant boxes (for some of them I didn't have black screen in GUI but still have connection problems). Finally I've updated VirtualBox and Vagrant again to the last versions and the problem still occurred.

The crucial thing was looking at icons in VirtualBox after running vagrantup (with GUI in Vagrantfile as I showed above) as on the below image

enter image description here

Although I had no errors in VirtualPC (no warnings that VT-x is not enabled) my V icon was earlier gray so it means the VT-x was disabled. As I said I had it enabled in my BIOS all the time.

Finally I realized the problem might by HYPER-V which I also installed and enabled to test sites on older Internet Explorer. I went to Windows Control Panel -> Programs and functions / Software and choose from the menu on left Turn on or Turn off Windows functions (hope you will find those, I use Polish Windows so don't know exact English names). I turned off Hyper-V, restarted PC and after running Virtual Box and vagrant up I finally had no errors, in GUI I have login screen and my V icon stopped to be gray.

I wasted a lot of time solving this issue (and many PC restarts) so I hope this might be helpful to anyone that have problem on Windows - make sure you have Hyper-V turned off in your Control Panel.

Jaehne answered 21/10, 2014 at 8:29 Comment(3)
That was the problem! Activated Virtualization on BIOS and disabled HYPER-V within Programs and functions. Worked as charm !!Brittan
@Brittan Glad it helped you, it took mu a lot of time to solve it.Prowess
Explicit ssh password helps me when a folder with dot vagrant subfolder resides in Dropbox or is shared otherwise between machines with potentially different ssh keys.Sandstrom
L
35

Mine was running fine and then this "Warning: Remote connection disconnect. Retrying..." over and over - maybe 20 times - until it connected. Based on answers above I just

vagrant destroy
vagrant up

and it was all good. Mine was very simple but I made it that way by cutting down the Vagrantfile to just the config.vm.box = "ubuntu/trusty64" and it was still doing it. So that is why destroying and starting again seemed the best choice. Given the stateless nature of these Vagrant images I don't see why that wouldn't work in every case. I'm just getting into this and I may yet learn that that isn't true.

Laureen answered 3/5, 2015 at 6:17 Comment(4)
Good solution if you can provision your vm. In my case building a vm is more complicated and will take even more time.Pumice
Yea I set up alias and other stuff on my VM, destroying it isn't really a great answerReversion
Nice, I tried many times with vragant halt but this work perfectly!Excess
Worked great for me, I was facing both localhost connection reset issue and this and destroying and creating vagrant again fixed those.Orgulous
M
19

I experienced the same issue on a Windows 8.1 machine. The connection timeout and enabling the gui was not usefull at all, the screen was black. The fix in my case was disabling "Hyper V"

Quote from Vagrant documentation https://docs.vagrantup.com/v2/hyperv/index.html

Warning: Enabling Hyper-V will cause VirtualBox, VMware, and any other virtualization technology to no longer work. See this blog post https://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxAndHyperVWithABCDEditBootEntryInWindows81.aspx for an easy way to create a boot entry to boot Windows without Hyper-V enabled, if there will be times you'll need other hypervisors.

Metrics answered 17/5, 2014 at 16:13 Comment(2)
This worked for me. I simply disabled Hyper-V in Programs and Features.Parfleche
I've tried all previous solutions and only this worked for me too!Fitly
F
17

If you are working on Windows 8 or 10, this is what worked for me:

  1. Change BIOS settings to allow virtualization of 64bit.
  2. Here is how:
    • Restart PC using Advanced Startup (Go to Advanced Startup -'restart now'-'troubleshoot' -'advanced option'- 'UEFI Firmware Setting' - 'Restart')
    • Inside BIOS window - Go to 'Advanced' menu/tab - Enable 'Intel Virtual Technology'
    • Save & Exit.
Forbiddance answered 30/6, 2014 at 15:20 Comment(3)
Same here on T440p notebookPresidium
Same here. On my machine it meant enabling virtualization Vt-xHourglass
Thank you! Virtualization was disabled in my BIOS settings. I had previously used vagrant in the same machine, but for some reason the BIOS setting was changed without me knowing. So check this setting first.Cartulary
L
8

I had an issue with this with an existing box (not sure what changed), but I could connect via SSH, even though the Vagrant box failed to boot up. As it happens my SSH key had changed somehow.

From the vagrant root folder I ran vagrant ssh-config which told me where the key file was. I opened this with puttygen and then it gave me a new key.

On my Linux guest, I edited ~/.ssh/authorized_keys and dropped the new public key in there.

Everything is working again - for now!

Lanford answered 24/2, 2015 at 11:16 Comment(0)
K
8

I had the same issue after I deleted this line from my Vagrantfile:

config.vm.network "private_network", type: "dhcp"

VM loaded fine after I put this line back.

Koah answered 15/2, 2016 at 14:18 Comment(1)
I'm using scotch box, all I did was uncomment the line with config.vm.network and it solved the problem.Levkas
T
5

I was testing a mounted folder in my vagrant VM by adding a new entry into /etc/fstab. Later on I logged out, ran vagrant halt, but when I ran vagrant up I got:

SSH auth method: private key
Warning: Remote connection disconnect. Retrying...

I read all these posts and tried all the ones that seemed relevant for my case (except for vagrant destroy, which would have certainly fixed my problem, but was a last resort in my case). The post by @Kiee gave me the idea to try to boot my VM directly from the VirtualBox GUI. During the boot process the VM halted itself and was asking me if I wanted to skip mounting the test folder that I had added earlier to /etc/fstab. (That's why vagrant couldn't boot the VM.) After answering 'NO' the VM booted no problem. I logged in, removed the naughty line from my fstab, and shutdown the VM.

After that vagrant was able to boot just fine.

Takeaway? If all of a sudden vagrant cannot boot back into your VM, try to boot directly from the provider (VirtualBox in my case). Chances are your boot is hanging for something totally unrelated to SSH.

Theodolite answered 2/4, 2016 at 7:7 Comment(0)
M
5

The SSH connection timeout during initial booting may be related to variety of reasons such as:

  • check whether virtualization is enabled in BIOS (as per comment),
  • system awaits for user interaction (e.g. share partition is not ready),
  • mismatch of your private key (check the config via vagrant ssh-config),
  • the booting process takes much longer time (try increasing config.vm.boot_timeout),
  • it's booting from the wrong drive (e.g. from the installer ISO),
  • VM firewall misconfiguration (e.g. iptables configuration),
  • local firewall rules, port conflict or conflict with a VPN software,
  • sshd misconfiguration.

To debug the problem, please run it a --debug option or like:

VAGRANT_LOG=debug vagrant up

If there is nothing obvious, then try to connect to it from another terminal, by vagrant ssh or by:

vagrant ssh-config > vagrant-ssh; ssh -F vagrant-ssh default

If the SSH still fails, try to run it with a GUI (e.g. config.gui = true).

If it's not, check the running processes (e.g. by: vagrant ssh -c 'pstree -a') or verify your sshd_config.


If it is disposable VM, you can always try to destroy it and up it again.

You should also consider upgrading your Vagrant and Virtualbox.


For more information, check the Debugging and Troubleshooting page.

Mechanic answered 11/12, 2016 at 14:3 Comment(0)
J
4

I had the same issue, but none of other answers fully solved my problem. Answer by @Kiee was helpful, although all I could see in the GUI was a black screen (with underscore in top-left, this issue in Virtual Box also has been raised separately in stack overflow, again nothing helped).

Eventually, a solution proved to be very simple: check version of your virtual machine.

More precisely, I had a box from someone else with 64-bit Debian, but Virtual Box insisted to treat it as 32-bit, what I didn't notice. To change it, open Virtual Box, then open terminal and run

vagrant up

wait for the line

default: SSH auth method: private key

now you can hit ctrl+C (or wait for timeout) and run

vagrant halt

your virtual machine won't be destroyed, so you can see it in the menu of Virtual Box, but will be powered off, so you can change settings. Chose your machine in the menu, click 'Settings'->'General' and chose proper 'Version', for me it was 'Debian (64-bit)'. After this type vagrant up again.

If this is a case for you (or different changes in 'Settings' solved your issue), you can create new box from the repaired one typing

vagrant package --output mynew.box

Some more details: host 32-bit Ubuntu 12.04, guest 64-bit Debian 8.1, Virtual Box 5.0.14, Vagrant 1.8.1

Johansen answered 4/2, 2016 at 20:33 Comment(1)
I had the same situation, I lost a day for this, also I didn't have 64 bit in my dropdown there so I cheched fixedbyvonnie.com/2014/11/… and solved itYoungman
C
4

There are many good answers here, and I couldn't read it all, but, I just came by to gave my little contribution too. I had 2 different problems:

  1. vagrant up wasn't able to find my ssh 'id_rsa' (because I didn't have it yet, at that time): I ran ssh-keygen -t rsa -b 4096 -C "[email protected]", based on this GitHub's article, and voilá, steped through that;

  2. Then, I got the same problem of this question "Warning: Connection timed out. Retrying...", eternally...: So, after reading a lot, I've restarted my system and looked at my BIOS (F2 to get there, on PC), and there were Virtualization disabled. I've enabled that, saved, and started the system once again, to check if it has changed anything.

After that, vagrant up worked like a charm! It's 4am but it is running! How cool, hã? :D As I know there are very few masochist developers like me, that would try this at Windows, specially at Windows 10, I just couldn't not to forget coming here and left my word... another important information, is that, I was trying to set-up Laravel 5, using Homestead, VirtualBox, composer etc. It has worked. So, hope this answer helps like this question and answers helped me. My best wishes. G-bye!

Crossness answered 20/5, 2016 at 7:12 Comment(0)
Y
4

I've found out that on MacOS with VirtualBox adding this to Vagrantfile will let you go further:

config.vm.provider 'virtualbox' do |vb|
  vb.customize ['modifyvm', :id, '--cableconnected1', 'on']
end
Yoga answered 27/3, 2017 at 9:51 Comment(2)
This worked for me after looking into this issue for hours!Dryad
glad to help :)Yoga
G
3

I had the same issue when I was using x64 box(chef/ubuntu-14.04).

I changed to x32 and it worked(hashicorp/precise32).

Guadalupeguadeloupe answered 25/7, 2014 at 10:40 Comment(1)
Your issue might be that you're running Hyper-V, see @Kri's answer above, I ran into issues with a x64 on x64 because I was running Hyper-VJilly
C
3

Maybe this is too simple an answer to help a lot of people, but worth trying if you haven't: Do a "vagrant halt" instead of a "vagrant suspend" then restart the VM with "vagrant up".

I think my problem was due to some "kworker" process getting buggy and constantly timing out in the VM and so doing a hard reboot seemed to reload the process correctly whereas a save and restore was just restoring the broken process in its broken state.

Cellarage answered 16/4, 2015 at 10:8 Comment(1)
Wow. At last. This worked for me. Am using window 7. @Cellarage thanks !Susiesuslik
S
3

I got this when running vagrant/VirtualBox inside VirtualBox. I resolved this by running the vagrant machine in the host machine.

Sweatt answered 8/9, 2016 at 19:40 Comment(0)
V
2

Installing an ubuntu32 bits on an AMD64 bits did the trick. I don't have access to the BIOs since its a restricted environment, but i was still able to get it to work with ubuntu/trusty32 instead of ubuntu/trusty64

Using Vagrant 1.6.3 with VirtualBox 4.3.15 on Windows 7 SP1

hope that helps.

Vernacularism answered 28/10, 2014 at 10:52 Comment(0)
M
2

Delete the file:

C:\Users\UserName\\.vagrant.d\insecure_private_key

Then run:

vagrant up
Minstrelsy answered 2/5, 2016 at 18:37 Comment(2)
I have searched the internet for three days and tried just about every solution I came across. Only to discover it can be as simple as this. My hero. Thank you! +1Crore
doesn't make a difference for me. i have mac, Vagrant 1.9.3Odelle
M
2

For me it was the compatibility between vagrant and virtual box.

I'm on windows 10 and what I did I uninstalled vagrant and virtual box

Then install an old version of virtual box specifically version 4.3.38 ( Install extension pack too for this version )

Then installed latest copy of vagrant ( 1.8.5 at the moment )

After that it worked.

Monmouthshire answered 31/7, 2016 at 5:0 Comment(1)
Had the same problem here. Virtualbox had an update available. Updating that, and a "vagrant destroy" and "vagrant up" command fixed it.Dituri
E
1

If you don't want to enable the GUI and then have to disable it later, you could also install the extension pack from Oracle:

http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html#extpack

Then put this in your Vagrantfile to enable VRDP:

vb.customize ["modifyvm", :id, "--vrde", "on"]

Now you can use RDP to connect to your box on demand without SSH needing to be running or the GUI open all the time.

Exciting answered 9/4, 2014 at 21:25 Comment(0)
F
1

What worked for me was allowing 64 bit virtualization on a 64 bit OS (Ubuntu 13.10) from BIOS.

Forbiddance answered 28/9, 2014 at 7:38 Comment(1)
You are probably talking about 64 bit virtualization!Lianneliao
T
1

One more possible solution for users of the VMware provider: For me the issue was resolved after removing a parallel installation of VirtualBox on the same host machine. Network interfaces between VMware and VirtualBox were apparently conflicting

Townscape answered 2/9, 2015 at 9:50 Comment(0)
P
1

I have faced the same problem. I fixed this by enabling Virtualization from BIOS setup.

Phytology answered 3/12, 2015 at 18:38 Comment(1)
Counter-intuitively, in my BIOS, I had to disable Virtualisation and enable VT-X. Try toggling these setting in your BIOS.Polo
N
1

Like some people here already pointed out, the error appears - among other things - if the VirtualBox image did not boot properly. For me using the GUI mode on Vagrant did not help much as it only showed a black window. In the VirutalBox GUI I checked the settings on my VM and figured out that somehow the OS was set incorrectly (Debian 32 instead of 64 Bit).

So I can only recommend checking the VirtualBox settings of the VM manually and getting the VM to boot without using Vagrant in first place.

Newsome answered 13/9, 2016 at 11:54 Comment(0)
T
1

Check your CPU's virtualization in BIOS setup is enabled.

Throughout answered 17/3, 2017 at 14:50 Comment(0)
L
1

In my case, giving it a static IP address, simply solved the problem:

config.vm.network "private_network", ip: "192.168.50.50"

Levkas answered 10/12, 2017 at 4:52 Comment(0)
E
1

I'm just sharing this so that it may help another person in future. rubo77 above gave me the inspiration for this answer.

I encountered this getting stuck in a connection timeout loop after uncommenting two lines in my vagrant file.

vb.gui="true"
config.vm.network "forwarded_port", guest: 80, host: 8080

Apparently the 1st line brings up the GUI which asks if you want to skip mounting or let vagrant mount manually. Commenting it back allowed me to log in, however I could still see 'Connection Aborted. Retrying' in the terminal.

So i ssh into my vagrant and typed.

sudo iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

Then vagrant reload and did not encounter any connection error. However take not this accepts all incoming traffic. So u might want to add rules to only allow port 8080 if you are going to use your bos for a long time.

Digital Ocean gives a very nice tutorial on adding rules to your iptables.

Remember to install iptables-persistent to save your firewall config

Eleen answered 9/2, 2021 at 7:46 Comment(0)
R
1

encountered similar issue for ubuntu/bionic64

by enabling the gui in Vagrantfile, i was able to login using default vagrant/vagrant

config.vm.provider "virtualbox" do |vb|
   vb.gui = true
end  

then reset the firewall using the following command

$ ufw force --reset  

then rebooted the system now this time without UI
was able to boot in without any issues

make sure to keep the backup of firewall rules before doing reset

Relate answered 27/2, 2021 at 5:50 Comment(0)
S
0

FWIW-- My problem was due to using a really old config file instead of a newer one. Using the new configuration file (and thus tweaked/changed DSL) fixed my problems instantly.

Stedmann answered 28/7, 2014 at 20:22 Comment(0)
A
0

What helped for me was the enabling the virtualization in BIOS, because the machine didn't boot.

Alluvion answered 18/8, 2014 at 8:23 Comment(1)
Counter-intuitively, in my BIOS, I had to disable Virtualisation and enable VT-X. Try toggling these setting in your BIOS.Polo
F
0

Rather than ctrl-d-ing out of the virtual box as I'm wont to do whenever I ssh into anything, I believe vagrant would prefer you get into another terminal and do a:

vagrant halt

to stop the box. Then there will be no issues getting back into the VB.

Fatal answered 28/8, 2014 at 20:34 Comment(1)
ctrl+d logs out. Nothing wrong with doing that, and it doesn't do anything to a running machine. vagrant halt stops the virtual machine.Leander
A
0

I faced the same issue, however non of the mentioned solutions worked for me! I solved it by downgrading Vagrant to 1.6.2 and now it works!

Apnea answered 6/9, 2014 at 15:5 Comment(0)
N
0

I had the same trouble with Vagrant 1.6.5 and Virtual Box 4.3.16. The solution described at https://github.com/mitchellh/vagrant/issues/4470 worked fine for me, I just had to remove VirtualBox 4.3.16 and install the older version 4.3.12.

Niel answered 8/10, 2014 at 9:59 Comment(0)
K
0

It used to help to switch to trusty32, but the situation now got worse again: I tried to use Homestead 2.0 and now I've got the Connection Timeout problem again, which would't usually be a problem, because switching to 32bit helped before. But now I can't just add a line like config.vm.box="ubuntu/trusty32" because we don't have a classic Homestead.yaml file anymore, the values in the new 2.0 Homestead.yaml file just seem to be inserted into the real one in the background and there ist no Vagrantfile available that I could manually edit ...

Hope someone can help ...

Koger answered 19/11, 2014 at 5:8 Comment(0)
B
0

From the virtualbox interface, I booted on a "CD" first, and disabled the hard drive boot. Hence it was booting on from a CD iso, and obviously not on the expected machine... I hope it helps. And I hope it made someone smile too... PEBCAK.

Bubbler answered 28/1, 2015 at 10:1 Comment(0)
R
0

Disabled iptables firewall inside the VM

This is how I solved it:

  • I enabled the GUI interface in my Vagrantfile (this is the config file)
  • I could login into the running VM in the Gui with the standard username vagrant and password vagrant
  • I disabled the running iptables firewall inside the VM

This solved my problem, I found out, that the firewall blocked all IPs from local networks like 192.168.x.x and 10.x.x.x

Adding a rule in /etc/iptables.d/199-allow-wan to allow all connections from wan:

ip46tables -A wan-input -j ACCEPT

(ip46tables is an alias) see this commit in my Vagrant example Freifunk community

Replacement answered 9/2, 2015 at 23:5 Comment(0)
M
0

Personally, for me, Tunnelblick VPN software was blocking the connection. Now when I'm booting up new VMs I temporary disable Tunnelblick.

Mada answered 7/4, 2015 at 6:13 Comment(0)
T
0

If you're using a wrapper layer (like Kitchen CI) and you're running a 32b host, you'll have to preempt the installation of Vagrant boxes. Their default provider is the opscode "family" of binaries.

So before kitchen create default-ubuntu-1204 make sure you use:

vagrant box add default-ubuntu-1204 http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04-i386_chef-provisionerless.box

for using the 32b image if your host doesn't support word size virtualization

Tompion answered 12/5, 2015 at 23:8 Comment(0)
A
0

Look for this line in your Homestead.yaml:

config.vm.network "forwarded_port", guest: 80, host: 8080

and change to:

config.vm.network "forwarded_port", guest: 80, host: 8000

then in Homestead directory, run:

vagrant destroy
vagrant up

See if it works.

Ascariasis answered 1/6, 2015 at 15:0 Comment(0)
S
0

I solved by just typing ˆC(or ctrl+C on Windows) twice and quitting the connection failure screen.

Then, I could connect via SSH (vagrant ssh) and see the error by my own.

In my case, it was a path mistyped.

Stateroom answered 23/9, 2015 at 2:32 Comment(0)
H
0

The way I had to solve this wasn't mentioned in this thread, so I'm posting the details here in case it helps anyone else.

What causes this is that vagrant can't ssh into the machine after it boots up. There's various reasons for this, as mentioned in this thread, such as the machine not booting up all the way, or iptables firewall blocking SSH.

In my case, the problem was that I inadvertently setup a "private_network" with an IP address in the same subnet as the built-in VirtualBox NAT network (in my case 10.0.2.0/24). This messed up the NAT network for the machine (but no errors shown anywhere), and since vagrant connects via the NAT network, it wasn't able to connect even though the machine was running and no firewalls were enabled.

Vagrant.configure("2") do |config|
  config.vm.network "private_network", ip: "10.0.2.31"
end

The fix was to update my VagrantFile and use a "private_network" IP that didn't conflict with VirtualBox's NAT network.

Vagrant.configure("2") do |config|
  config.vm.network "private_network", ip: "10.0.4.31"
end
Hardspun answered 27/9, 2015 at 23:42 Comment(0)
M
0

I got it resolved when I killed putty process. Because I have git-ssh and putty both running. They were appearing to fight each other for ssh accessing. Only one is enough.

Minstrelsy answered 26/5, 2016 at 12:15 Comment(0)
D
0

My solution to this issue was that my old laptop was taking wayyyyyyyyyyy too long to start up. I opened Virtual Box, connected to the box and waited for the screen to load. Took about 8 minutes.

Then it connected and mounted my folders and went ahead.

just be patient sometimes!

Dhiman answered 30/11, 2016 at 5:6 Comment(0)
S
0

My solution turned out to be none of the above exactly. I'm running Ubuntu 14 as guest inside a Windows 7 host. I had been running this vagrant box fine, but I started it up again after not using it for a couple of months, and it kept coming up with the SSH connection timeout. It turned out that somehow the key pair didn't work - so I copied the Vagrant public key into Ubuntu according to the instructions on this page. But that wasn't all. I then discovered that the private key in my base box was different than the private key here. Putting this private key in as the vagrant_private_key file in C:\Users\your-user.vagrant.d\boxes\vagrant-box-name\nnnnnnnn\virtualbox after placing the public key into Ubuntu fixed the problem.

Sagamore answered 21/3, 2017 at 1:23 Comment(0)
D
0

Here is how it worked for me:

After "vagrant up" started the virtual machine, turned off the machine and go to the new virtual machine settings in virtualbox. Then go to "Network" -> "Advanced"

Adapter Type: I changed from "Intel PRO XXXXX" to "PCNet-Fast" (or any other adpter other than Intel PRO did work)

Delorisdelorme answered 2/4, 2017 at 12:12 Comment(0)
L
-3

Had this issue for more than one week, Tried all solutions,

1. giving SSH username and password
2. Enabling GUI interface
3. Updated Virtual Box and Vagrant

Nothing worked.

Finally got the solution from this link

Add the Google public DNS IP to your Wifi Settings

under Network Preferences > Wifi > Advanced > DNS add IP Address 8.8.8.8

Worked perfectly. May be this helps anyone who have problem in Mac. Thanks Skovmand

Lynnlynna answered 20/11, 2014 at 16:8 Comment(1)
in mac -> network preference, i've mentioned it in my answerLynnlynna
A
-4

It's a new 'feature' of vagrant. Take a look here: https://github.com/mitchellh/vagrant/issues/3329

They will change the 'Error' to 'Warning'. It's just telling you that the machine isn't booted yet, and it's trying to connect...

Aureole answered 8/5, 2014 at 19:32 Comment(1)
Answers are always welcome as long as they provide a solution. This one does not give a way to solve the initial error. Maybe it could have been a comment of the question instead ?Bubbler

© 2022 - 2024 — McMap. All rights reserved.