Problems installing on Windows - stuck on vagrant up [SOLVED]

Hey all,

The company I work for has 300+ WordPress all managed poorly by a single outsourced employee who manages them all over FTP. Updating them or keeping them uniform is - as you might guess - challenging. I’ve decided I’d like to take over managing these sites internally using trellis, bedrock & a sage based template and am now working on getting the entire suite up and running locally so I can test how feasible this will be. However I am stuck on the vagrant up call, as I keep getting errors there.

I’ll post the error first in case it is a common occurring one you recognize immediately - though I searched beforehand and found nothing - before I describe how I got there:

TASK [python_interpreter : Get Ubuntu release] *********************************
System info:
Ansible 2.8.4; Vagrant 2.2.7; Linux
Trellis Head

Failed to connect to the host via ssh: Warning: Permanently added
‘[127.0.0.1]:2222’ (ECDSA) to the list of known hosts.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for ‘/mnt/d/dev/repos/example.com/trellis/.vagrant/machines/
default/virtualbox/private_key’ are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key “/mnt/d/dev/repos/example.com/trellis/.vagrant/machines/default/virt
ualbox/private_key”: bad permissions
vagrant@127.0.0.1: Permission denied (publickey,password).
fatal: [default]: UNREACHABLE! => {“changed”: false, “unreachable”: true}

PLAY RECAP *********************************************************************
default : ok=0 changed=0 unreachable=1 failed=0 skipped=0 rescued=0 ignored=0

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.

Now background: This is a newish 16GB ram pc with a i7-8750H running Windows 10, freshly formatted with nothing installed prior except for Firefox, Node, NPM, JetBrains Toolkit, Jetbrains PhpStorm, Git and GitHub Desktop dev-wise.

  • Installed the latest version of Vagrant (2.2.7) on my Windows host machine
  • Enabled Windows Subsystems for Linux by running ‘Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux’ in PowerShell as Administrator, then rebooted
  • Downloaded and installed the latest Ubuntu 18 from the Windows Store
  • Once in WSL, I followed the instructions at roots io getting-started/docs/windows-basic-setup/, with the exception that I had no ~/.ssh/config, so I made it using touch and added the configuration the linked page.
  • Tested my configuration by running ‘ssh -T git@github.com’ and got a ‘permission error’, so I ran ‘chmod 600 ~/.ssh/config’ to fix it
  • Installed the same version of Vagrant on Ubuntu and added both ‘export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS=“1”’ or ‘export PATH=“$PATH:/mnt/c/Program Files/Oracle/VirtualBox”’
  • Followed the instructions on roots io getting-started/docs/windows-development-environment-trellis/ with the exception that I had to specify ansible version 2.8.4 as this was the latest version supported by Trellis I believe.
  • Afterwards I created a trellis project as per roots io trellis/docs/installing-trellis/ and was hoping I was ready to start development as per root io trellis/docs/local-development-setup/, but I can’t get ‘vagrant up’ to work.
  • Destroying the box, removing the the trellis project, running ‘export VAGRANT_WSL_WINDOWS_ACCESS_USER_HOME_PATH=“/mnt/d/dev/repos”’’ (/mnt/d/dev/repos being my repo directory) and repeating the previous step changed nothing.

Anyone have experience with installing Trellis on Windows that could point me in the right direction?

Thanks in advance :slight_smile:

PS: Sorry about the mangled links, small editor and I can only post 4 links at a time it seems.

Seems I’ve figured it out on my own, I’ll post the answer here in case anyone finds themselves in a similar boat.

Even when making sure my ~/.ssh/id_rsa and ~/.ssh/config where owned by my and had 600 permission, I think that Trellis’ vagrant file makes a copy of this file and stores it in the repository, ‘/mnt/d/dev/repos/example.com/trellis/.vagrant/machines/default/virt
ualbox/private_key’ for me, as I keep my repositories on my D drive. Apparently WSL has some issues with setting permissions in a mounted windows drive.

But I found a stackoverflow post referencing this WSL dev blogpost Chmod/Chown WSL Improvements - Windows Command Line stating they had made some improvements to chmod and chown, you just had to unmount and remount the drive with the metadata flag like so

sudo umount /mnt/d
sudo mount -t drvfs D: /mnt/d -o metadata`

Once I did this, I used vagrant destroy to remove the box and then ran vagrant up and for the first time ansible managed to complete all it’s tasks.

Is there a way to get this metadata flag included in the vagrant file, or should I make an issue on GitHub for that?

You should also be able to resolve this issue by adding the following to /etc/wsl.conf:

[automount]
options = "metadata,umask=22,fmask=11"

(That will persist after WSL has been restarted; I’m not sure mounting/unmounting would have the same effect.)

Not sure that needs to be included in the Vagrantfile, since we already document a solution: https://roots.io/getting-started/docs/windows-development-environment-trellis/

Can’t believe I missed that

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