Trying to get Trellis up and running on Windows 10 WSL2.
Have followed the guide and things have been going great.
Until it’s time for trellis up
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.36) is already installed, skipping.
- mailpit (v1.0.0) is already installed, skipping.
Running command => vagrant up
Vagrant failed to initialize at a very early stage:
Vagrant is unable to use the VirtualBox provider from the Windows Subsystem for
Linux without access to the Windows environment. Enabling this access must be
done with caution and an understanding of the implications. For more information
on enabling Windows access and using VirtualBox from the Windows Subsystem for
Linux, please refer to the Vagrant documentation:
https://www.vagrantup.com/docs/other/wsl.html
exit status 1
I follow instructions, and run the following from the URL above:
trellis up
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.36) is already installed, skipping.
- mailpit (v1.0.0) is already installed, skipping.
Running command => vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The host path of the shared folder is not supported from WSL. Host
path of the shared folder must be located on a file system with
DrvFs type. Host path: /home/user/site.com/trellis
* The host path of the shared folder is not supported from WSL. Host
path of the shared folder must be located on a file system with
DrvFs type. Host path: /home/user/site.com/trellis
* The host path of the shared folder is not supported from WSL. Host
path of the shared folder must be located on a file system with
DrvFs type. Host path: .
exit status 1
I have been doing the same thing on NTFS. Not sure why I installed NTFS instead of exfat but I know it has some issues playing nicely with WSL but the necessary actions below are necessary for windows on any filesystem.
In WSL go to your wsl.conf file in the root etc folder. Add the line below to your profile
Since you are mounting things in a directory outside of WSL you will also need to specify where WSL will need access on Windows. I put the access directing to my dev folder where I am keeping my projects by using the line below and typing it into the WSL prompt.
“/mnt/c/dev”, is the root folder where I keep my projects and that can be changed to what yours is.
Right now I can’t get the server pulled up when I goto to the site in a browser. I think everything is working since I can SSL into the vagrant machine trellis created but I can’t access the actual website. When I go to the local dev site at the ________.test page it refuses to connect. so I am currently stuck there trying to figure out what is going on. It might have something to do with my work firewall or something else but I am currently stumped.
exfat is better for compatibility between machines and supported by macs, Linux and so on. Windows NT is best if you only deal with windows. Maybe I was mistaken in mentioning exfat. I thought windows started to automatically use exfat but I may be wrong. I know exfat supports chmod which is good for changing permissions through WSL. I just don’t ever remember having problems with Trellis-CLI before on a windows machine like this. I’m on my work PC though and it could also be firewall and security protocols messing things up since we are pretty much locked down now.
Apologies if this is obvious, but on WSL, is your dev folder supposed to be located inside the Windows file system, e.g. /mnt/c/dev/example.com? I realize this is what TechHedz said, just trying to understand how it works.
I’ve now tried to create the project within here, and it’s incredibly slow. I stopped it after 30 minutes. Or are you supposed to set it up in /home/User/example.com and then move it afterwards?
Tried that too, and that is just as slow.
Or are you supposed to create your project on the linux side and use some sort of symlink to the Windows FS?
Haha yes you can definitely tag me anytime, and apologies my delayed response, I’ve just returned from a period of offline time.
I’m also on NTFS so that should be just fine, are you still encountering the same issue after adjusting the wsl.conf as suggested by @TechHedz ?
@TechHedz if you’re able to access the machine via ssh, but it isn’t showing in the browser, it may be an issue related to your hosts file. You can try navigating to C → Windows → System32 → drivers → etc - > hosts and adding the following two lines:
(The IP would need to be 192.168.50.5) if you’re using an older version of trellis, but you can see this value by viewing your Vagrant config file in your Trellis project.
Thanks again, @cheezman, really appreciate the hand holding
trellis new example.com will need to be run from within your WSL environment. It may take a while on the “Installing dependencies” step.
Yes, thanks, that’s what I’m doing but what I’m asking is: Do I run the command within the /home/user/dev (linux) folder structure or the Windows one /mnt/c/Users/user/dev?
The reason I ask is, if I run in it /home/user/dev it’s super fast, but I get the error from a few posts up (even after running the ´export VAGRANT_WSL …` commands.
If I run it (trellis new) in mnt/c/Users/user/dev it is incredibly slow – it takes 30 minutes for it to create, and sometimes times out.
Is this just how it works, or am I not doing it right?
@cheezman It’s working - at least within the mnt/c/Users/ path. But it is painfully slow, whereas if created in the Linux path (/home/user/dev) it’s close to instant.
Is that just how it is - I have to create it in the Windows env? Or is there some sort of “link” I can create, allowing to maybe set it up under Linux? Sorry if I’m asking the same again, just want to make absolutely sure.
The error you’re getting is what I’m getting too (thanks for testing that out, btw) - but I was under the impression that is what I was fixing inputting the export commands?
I’ve now also gotten to installing Sage, following instructions. All works, but again, yarn build took:
From my experience, yes it has to be created from within Windows. You can definitely have a go at it, but I remember running into some permissions related errors (along with the shared folder error above).
Lovely stuff, I’ve run a yarn build now on a project of mine with a larger codebase and it compiled within 80s.
Can’t get any sort of provisioning to complete. Neither trellis ssh development, vagrant provision, trellis provision development – and vagrant ssh doesn’t do anything.
trellis ssh development returns:
❯ trellis ssh development
Running command => ssh vagrant@mysite.test
Error running ssh: exit status 255
❯ trellis provision development
Starting galaxy role install process
- composer (1.9.0) is already installed, skipping.
- ntp (2.3.1) is already installed, skipping.
- logrotate (v0.0.5) is already installed, skipping.
- swapfile (v2.0.36) is already installed, skipping.
- mailpit (v1.0.0) is already installed, skipping.
Running command => ansible-playbook dev.yml --inventory-file=.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory -e env=development
PLAY [WordPress Server: Install LEMP Stack with PHP and MariaDB MySQL] *********
TASK [Gathering Facts] *********************************************************
[WARNING]: Unhandled error in Python interpreter discovery for host default:
Failed to connect to the host via ssh: ssh: connect to host 172.18.208.1 port
2222: Connection timed out
fatal: [default]: UNREACHABLE! => {"changed": false, "msg": "Data could not be sent to remote host \"172.18.208.1\". Make sure this host can be reached over ssh: ssh: connect to host 172.18.208.1 port 2222: Connection timed out\r\n", "unreachable": true}
PLAY RECAP *********************************************************************
default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0
exit status 4
There appears to be issues with connecting via ssh.
vagrant_ip in vagrant.default.yml: vagrant_ip: '192.168.56.5'
The lines I’ve shared are NOT present in my Windows hosts (C → Windows → System32 → drivers → etc - > hosts)