Open mdudzinski opened 4 years ago
For the reference, vagrant 1.9.4 (the last release before WSL1 support was added) doesn't have this problem as it's not aware of WSL. It's available here: https://releases.hashicorp.com/vagrant/1.9.4/
I got this working by adding a check for ext4
to this line in platform.rb
I got this working by adding a check for
ext4
to this line in platform.rb
It would be nice if this could land in 2.2.20... its really unfortunate you cannot host mount from inside WSL2 without moving the project to /mnt/c.
I tried this out, but it ended up not working for me:
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["clonemedium", "C:\\Users\\my.name\\VirtualBox VMs\\myrepo_1649868915665_50392\\ubuntu-bionic-18.04-cloudimg.vmdk", "./C:\\Users\\my.name\\VirtualBox VMs\\myrepo_1649868915665_50392\\ubuntu-bionic-18.04-cloudimg.vdi", "--format", "VDI"]
Stderr: 0%...
Progress state: VBOX_E_IPRT_ERROR
VBoxManage.exe: error: Failed to clone medium
VBoxManage.exe: error: Could not create the directory '\\wsl$\Ubuntu-18.04\home\myuser\git2\myrepo\C:\Users\my.name\VirtualBox VMs\myrepo_1649868915665_50392' (VERR_INVALID_NAME)
VBoxManage.exe: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component VirtualBoxWrap, interface IVirtualBox
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCloneMedium(struct HandlerArg *)" at line 1071 of file VBoxManageDisk.cpp
Not sure if that's because of the vagrant-berkshelf
integration we use or what, but it doesn't seem like it handles rerouting the paths correctly.
@jamesbattersby How did you build vagrant from source with the change for Windows (the exe) since the WSL and Windows vagrant versions need to be the same?
@lectrician1 It was some time ago, but I'm fairly sure that I didn't update the Windows version, just patched the WSL version.
Hm actually good idea. I was building the current master from source in WSL and that doesn't have the same version number so it refused to connect with the Windows program. However, I should just download the previous version that matches my current Windows program in WSL and patch and build that. I'll report back if it works.
Well got them to run. However, ran into No host IP was given to the Vagrant core NFS helper. This is an internal error that should be reported as a bug.
when first calling vagrant/exec/vagrant up --provider=docker
. Rerunning vagrant up
caused this error to go away.
However, I then noticed that none of my WSL2 folders were being shared in the Docker container so I ran vagrant/exec/vagrant reload
and ended up getting this error which I've been unable to solve:
==> default: Stopping container...
==> default: Creating and configuring docker networks...
==> default: Vagrant has noticed that the synced folder definitions have changed.
==> default: With Docker, these synced folder changes won't take effect until you
==> default: destroy the container and recreate it.
==> default: Enabling network interfaces...
==> default: Starting container...
A Docker command executed by Vagrant didn't complete successfully!
The command run along with the output from the command is shown
below.
Command: ["/sbin/ip", "-4", "addr", "show", "scope", "global", "docker0", {:notify=>[:stdout, :stderr]}]
Stderr: Device "docker0" does not exist.
Stdout:
Well that error went away when I did followed https://github.com/docker/for-linux/issues/123#issuecomment-346546953 but then I realized that No host IP was given to the Vagrant core NFS helper. This is an internal error that should be reported as a bug.
actually means something because when I checked in the container to see if a shared folder was present in it from the WSL filesystem, it wasn't there.
Is your feature request related to a problem? Please describe. Currently, Vagrant doesn't allow to have sync folders located on WSL2, the following error is returned
However, this should be returned only when running Vagrant from WSL1. WSL2 uses actual ext4 file systems and it should be possible to have synced folders just like on a linux OS running bare metal.
Describe the solution you'd like Not sure what's the best approach here but I was able to workaround this by changing this method to return
false
and building Vagrant from source.Perhaps it should be split into
wsl1?
andwsl2?
methods.Describe alternatives you've considered N/A
Additional context N/A
Cheers!