Roots Discourse

Can't get vagrant up on WSL

Following along with the WSL docs I don’t seem to be able to get vagrant up and going - even when using the example project.

5@numberphile:~/roots-example-project.com/trellis$ ls
CHANGELOG.md  Vagrantfile  deploy-hooks  group_vars  requirements.yml  server.yml           xdebug-tunnel.yml
LICENSE.md    ansible.cfg  deploy.yml    hosts       roles             vagrant.default.yml
README.md     bin          dev.yml       lib         rollback.yml      variable-check.yml

5@numberphile:~/roots-example-project.com/trellis$ vagrant up
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.

As can be seen in the output, the vagrant.default.yml is right there.

Let’s ignore that, for a moment. If I’ve started WSL through the Store App in the Start Menu, and were to attempt to do a vagrant init I’d get the following:

5@numberphile:~/roots-example-project.com/trellis$ vagrant init
The user that is running Vagrant doesn't have the proper permissions
to write a Vagrantfile to the specified location. Please ensure that
you call `vagrant init` in a location where the proper permissions
are in place to create a Vagrantfile.

Ok, so I’m not really sure why that’s happening - but it’s interesting. Typically, that’s not how I start WSL, I usually call bash.exe directly.

If I’ve just opened CMD.exe and started WSL by calling bash.exe then attempting to run a vagrant init creates a Vagrantfile in the root of my Windows User’s Home Directory, as that’s the default location for CMD to run from.

5@numberphile:~/roots-example-project.com/trellis$ vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

Seeing that the Vagrantfile would be created/looked for wherever bash.exe was called from I had the idea to open the location where WSL actually stores data. Now, I know that’s a bad idea - but in the interest of testing this further I decided to continue. Since I’m running Ubunut 18.04 LTS via WSL, that location for me and my copy of the example project is C:\Users\5\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc\LocalState\rootfs\home\5\roots-example-project.com\trellis>

So if I navigate explorer.exe to that path, then open cmd.exe in the current directory, call bash.exe and the same steps again I get slightly different results.

5@numberphile:~/roots-example-project.com/trellis$ ls
CHANGELOG.md  Vagrantfile  deploy-hooks  group_vars  requirements.yml  server.yml           xdebug-tunnel.yml
LICENSE.md    ansible.cfg  deploy.yml    hosts       roles             vagrant.default.yml
README.md     bin          dev.yml       lib         rollback.yml      variable-check.yml

5@numberphile:~/roots-example-project.com/trellis$ vagrant up
A Vagrant environment or target machine is required to run this
command. Run `vagrant init` to create a new Vagrant environment. Or,
get an ID of a target machine from `vagrant global-status` to run
this command on. A final option is to change to a directory with a
Vagrantfile and to try again.

5@numberphile:~/roots-example-project.com/trellis$ vagrant init
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.

So, once again we’ve verified that the vagrant.default.yml file is in place, verified that vagrant up isn’t starting anything, but we are seemingly able to create a Vagrantfile in this directory - even though we shouldn’t need to.

Long, winding story short, I’m having trouble getting Vagrant to execute vagrant up when trying to work with the roots example project inside of WSL on a fresh installation of Windows 10 Pro 1809. I noticed that depending on how WSL is launched, it seems to not work in the path properly or pass the wrong path to vagrant.exe. Then I discovered that even though I cannot get vagrant to read the vagrant.default.yml file from the location, however I can create a Vagrantfile there.

Does anyone have any suggestions? I’ve seen a few seemingly-related issues with Vagrant and WSL here on the board but they didn’t seem to get much attention. I’d appreciate any insight that can be provided.

I ran into this issue when trying to do a vagrant up on a site I tried putting in ~/sites

When I moved the project to /mnt/c/Users/username/Sites/ I was able to do a vagrant up

This sound like it might be caused by the problem I described here: Vagrant up 'base' error (WIN10)

This topic was automatically closed after 42 days. New replies are no longer allowed.