vagrant
vagrant copied to clipboard
"Warning: Connection refused. Retrying" is repeat and not connect VM
Vagrant version
2.2.14
Host operating system
windows 10 pro ans WSL2
Guest operating system
ubuntu/trusty64
Vagrantfile
I get vagrant init ubuntu trusty64 and not modify
Debug output
Provide a link to a GitHub Gist containing the complete debug output:
https://www.vagrantup.com/docs/other/debugging.html. The debug output should
be very long. Do NOT paste the debug output in the issue, just paste the
link to the Gist.

Expected behavior
vagrant up
Actual behavior
"Warning: Connection refused. Retrying" is repeat unlimtly and not connect VM
Steps to reproduce
Environment: Windows 10 Pro / WSL2(Ubuntu) / Virtualbox
- vagrant init ubuntu/trusty64
- vagrant up
References
I compare to vagrant tasks on Ubuntu host. Ubuntu host's Virtualbox VM is 2 Network Adapter(NAT, host-only) but Windows host's Virtualbox VM is 1 Network Adaptaer(only NAT) I think bug is correlate Network adapter.
hi @bosungkim-git can you add the exact build of your Windows 10 pro? thank you
@all @soapy1 i think WSL 2 and vagrant will not work when hyper-v is turn on, instead use WSL 1. i tested it and it works.
I'm experiencing the same problem, though I swear that it worked flawlessly with WSL2 up until some months ago.
Loads of questions have been asked on Stack Overflow regarding this exact topic over the last month, so it's definitely a problem.
Now it seems like that the only reliable way to get Vagrant and Ansible working together is running a Linux OS. And here I (stupidly) thought that Windows and WSL2 could accommodate all my needs...
I'm experiencing the same problem, though I swear that it worked flawlessly with WSL2 up until some months ago.
Loads of questions have been asked on Stack Overflow regarding this exact topic over the last month, so it's definitely a problem.
Now it seems like that the only reliable way to get Vagrant and Ansible working together is running a Linux OS. And here I (stupidly) thought that Windows and WSL2 could accomodate all my needs...
@ImMaury if cannot turn off hyper-v in windows 10, just use it as a vagrant provider, i am already using it.
if you turn of your hyper-v, you can use vagrant and virtualbox on WSL 1. it is working as expected.
I'm experiencing the same problem, though I swear that it worked flawlessly with WSL2 up until some months ago. Loads of questions have been asked on Stack Overflow regarding this exact topic over the last month, so it's definitely a problem. Now it seems like that the only reliable way to get Vagrant and Ansible working together is running a Linux OS. And here I (stupidly) thought that Windows and WSL2 could accomodate all my needs...
@ImMaury if cannot turn off hyper-v in windows 10, just use it as a vagrant provider, i am already using it.
if you turn of your hyper-v, you can use vagrant and virtualbox on WSL 1. it is working as expected.
There are too many caveats for me when it comes to using Hyper-V.
And no, I cannot turn off Hyper-V/WSL2 because I need Docker.
Welp, having Vagrant working on Windows with all the whistles and bells was a dream that didn't last long.
@ImMaury i created a Video Tutorial guide for Vagrant and hyper-V, please check it Vagrant using Hyper-V (Substitute for Virtualbox problem in Windows 10 Pro) thank you
I've just figured out that Vagrant works fine with Virtualbox on WSL1 WITHOUT having to disable Hyper-V. It's probably a networking problem caused by WSL2 that prevents Vagrant from talking with the Virtualbox VMs (not sure if this is relevant: https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723).
So for the time being I'll be using a WSL1 distro just for Vagrant.
I've just figured out that Vagrant works fine with Virtualbox on WSL1 WITHOUT having to disable Hyper-V. It's probably a networking problem caused by WSL2 that prevents Vagrant from talking with the Virtualbox VMs (not sure if this is relevant: microsoft/WSL#4150 (comment)).
So for the time being I'll be using a WSL1 distro just for Vagrant.
@ImMaury yes better use WSL1 for the meantime. the main problem is WSL 2 needs hyper-v to turn on but virtualbox needs hyper-v to turn off.
I've just figured out that Vagrant works fine with Virtualbox on WSL1 WITHOUT having to disable Hyper-V. It's probably a networking problem caused by WSL2 that prevents Vagrant from talking with the Virtualbox VMs (not sure if this is relevant: microsoft/WSL#4150 (comment)). So for the time being I'll be using a WSL1 distro just for Vagrant.
@ImMaury yes better use WSL1 for the meantime. the main problem is WSL 2 needs hyper-v to turn on but virtualbox needs hyper-v to turn off.
@jason-migz that's not true, latest versions of VirtualBox do work even when Hyper-V is enabled.
I've just figured out that Vagrant works fine with Virtualbox on WSL1 WITHOUT having to disable Hyper-V. It's probably a networking problem caused by WSL2 that prevents Vagrant from talking with the Virtualbox VMs (not sure if this is relevant: microsoft/WSL#4150 (comment)). So for the time being I'll be using a WSL1 distro just for Vagrant.
@ImMaury yes better use WSL1 for the meantime. the main problem is WSL 2 needs hyper-v to turn on but virtualbox needs hyper-v to turn off.
@jason-migz that's not true, latest versions of VirtualBox do work even when Hyper-V is enabled.
@ImMaury did you already try it in windows 10 pro build 19042.685? i tried it and it's not working, that is why i made this tutorial video for Vagrant using hyper-v
I've just figured out that Vagrant works fine with Virtualbox on WSL1 WITHOUT having to disable Hyper-V. It's probably a networking problem caused by WSL2 that prevents Vagrant from talking with the Virtualbox VMs (not sure if this is relevant: microsoft/WSL#4150 (comment)). So for the time being I'll be using a WSL1 distro just for Vagrant.
@ImMaury yes better use WSL1 for the meantime. the main problem is WSL 2 needs hyper-v to turn on but virtualbox needs hyper-v to turn off.
@jason-migz that's not true, latest versions of VirtualBox do work even when Hyper-V is enabled.
@ImMaury did you already try it in windows 10 pro build 19042.685? i tried it and it's not working, that is why i made this tutorial video for Vagrant using hyper-v
@jason-migz no, my build number is 19041.685 (Windows 10 Pro). I'm not in the insider program.
Edit: I've updated to 20H2 (build number: 19042.685) and VirtualBox is still working. My VirtualBox version is 6.1.16.
The issue at hand is not Virtualbox / Hyper-V but the networking stack of WSL2
In WSL2 networking is done over an extra adapter (Hyper-V Virtual Ethernet Adapter) In my case this adapter is running a 172.17.80.1/20 network, where 172.17.80.1 is the windows host and my Debian WSL2 guest has 172.17.94.74
Now paired with the way the Virtualbox provider is implemented vagrant tries to connect SSH over 127.0.0.1 in the WSL2 "vm".but the virtualbox port forward 2222 -> 22 is only available locally on the windows side of the network.
For this to work three steps are required:
- any firewall on the windows side has to allow traffic in for port 2222 on the WSL2 adapter
- the port forward in Virtualbox needs to be configured to allow access from the WSL2 network (it is bound to 127.0.0.1 only)
- vagrant need to connect to 172.17.80.1 instead of localhost
A plugin for vagrant to use it in wsl2 exists. Hope this helps.
After spending several hours trying to troubleshoot this issue when running vagrant up with WSL2, I ended up switching back to WSL1 and it finally worked.
I was following this tutorial which seemed to work for that user who was using WSL2, but not for me. After reinstalling my Ubuntu distro (20.04 LTS) following the same tutorial except with WSL1 this time vagrant started up with no issues.
@merlin1991 were you able to get vagrant working on WSL2? If so, do you mind sharing some more details on where those 3 configurations are made?
A plugin for vagrant to use it in wsl2 exists. Hope this helps.
@marian-lingsch this worked for me, thank you! Do you know if there's an equivalent for VMware Workstation/Desktop?
@graememeyer Sorry I don't know if something similar exists for VMware.
A plugin for vagrant to use it in wsl2 exists. Hope this helps.
@marian-lingsch, thanks for this solution!
This solved my issue! After hours of searching for a solution to my connection issue, I finally found one.