7

I have a frustrating problem. I want to run Vagrant from within WSL. I followed the guide on Vagrant: https://www.vagrantup.com/docs/other/wsl.html

After following the guide I created a Vagrantfile with the following:

Vagrant.configure(2) do |config|
  config.vm.provider "virtualbox" do |vb|
    vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
  end
  config.vm.box = "ubuntu/xenial64"
  config.vm.network "forwarded_port", guest: 8000, host: 8001

end

My environment variables that I created are the following:

PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/c/Windows/System32/:/mnt/c/Program:/mnt/c/Program Files/Oracle/VirtualBox
VAGRANT_WSL_ENABLE_WINDOWS_ACCESS=1

This link provides the output of vagrant up --debug: https://pastebin.com/MT40DLHT

Does anyone know what I am doing wrong?

Haije Ploeg
  • 162
  • 2
  • 12
  • can you check if you can run `VBoxManage --version` from wsl ? it probably won't work, you'd need to fix your PATH (check where VBoxManage program is installed and put this folder in your PATH, not the main VirtualBox directory, there might be a subdirectory but I don't have windows available to check) – Frederic Henri Jul 28 '17 at 14:56
  • @FrédéricHenri I found out that there was something wrong with my PATH and I had to do Windows updates. Now that is fixed I'm getting really close. I now get the following error: The executable 'vagrant.exe' Vagrant is trying to run was not found in the PATH variable. This is an error. Please verify this software is installed and on the path. But does this mean that I need to install vagrant on Windows as well? – Haije Ploeg Aug 01 '17 at 15:09
  • add the path of `vagrant.exe` to your PATH variable and it should work – Frederic Henri Aug 01 '17 at 15:20
  • Okay, but does this really mean that I should install vagrant within wsl and on WIndows as well to get it to work? – Haije Ploeg Aug 01 '17 at 15:25
  • @HaijePloeg What did you conclude? I also followed the guide on HashiCorp's website for WSL and am receiving the same error (vagrant.exe not in PATH). – benjivm Sep 17 '17 at 05:41
  • @gmask You should use the latest version of Windows, the latest update exports all the path variables of Windows to WSL, so you can use windows exe files in wsl. You should also use VAGRANT_WSL_ENABLE_WINDOWS_ACCESS=1. To manually export vagrant.exe, use: `export PATH=/mnt/c/location/to/vagrant:$PATH – Haije Ploeg Sep 17 '17 at 14:18
  • I am on the latest version of Windows insider running Ubuntu 16.04 and have that command in bash. What you're saying though is that I need to install Vagrant in Windows as well using the installer .exe, not just in Ubuntu using the .Deb, which completely defeats the purpose of having it in WSL anyway... Right? – benjivm Sep 17 '17 at 14:42
  • Hi, yes you should install it in Windows as well. But the Vagrant on Windows comes with some limitations, such as it relies on git ssh, no rsync and a some other things. With vagrant within WSL you have a fully working vagrant installation on a Windows host. – Haije Ploeg Sep 17 '17 at 15:18
  • https://github.com/hashicorp/vagrant/issues/8962#issuecomment-334579481 Have a look here how I got it working. – dza Oct 05 '17 at 20:29

0 Answers0