When Microsoft announced the Windows Subsystem for Linux, now seemingly rebranded as Bash on ubuntu on Windows, I was excited at the possibility of having Drupal VM (and other similarly command-line-friendly open source projects) work better in a Windows environment. But unfortunately, the Anniversary update's version of WSL/Ubuntu Bash was half-baked, and there were a lot of little issues trying to get anything cohesive done between the Windows and Ubuntu Bash environments (even with cbwin).
Then, a year or so later, Microsoft finally announced that tons of improvements (including upgrading Ubuntu in the WSL from 14.04 to 16.04!) would be included in the 'Creators Update' to Windows 10, dropping tomorrow, April 11.
One of the major improvements would be the ability to call out to Windows executables from within Ubuntu Bash, which was added in October 2016, but only available to those willing to run Microsoft's bleeding-edge 'Insider' builds. This feature is going to be included with the rest of the improvements in the Creator's update, so I thought I'd update early and explore whether this is the panacea I dreamt of when I first heard about WSL/Ubuntu Bash.
tl;dr: It's not a panacea. But it is something. And things are improved significantly from where we were one year ago, as far as open source devs who develop in Windows (by choice or by dictum).
How to update to Windows 10 'Creators Update'
If it's April 11 or later, you can just use Windows Auto Update mechanism to upgrade to the Creators Update version of Windows 10. It seems the ISO images are already on microsoft.com, and it's only April 10 where I live, so I'm not sure when your particular computer will see the update become available for install.
How to Install WSL/Ubuntu Bash
Note: If you've previously installed Ubuntu Bash on an older version of Windows, and want to get the new version running Ubuntu 16.04 instead of 14.04, you need to run Powershell as administrator, and enter the command
lxrun /uninstall /full.
lxrun /install /y
- After installation is finished, enter 'Ubuntu' in Cortana/search and open "Bash on Ubuntu on Windows"
- Confirm you're on Ubuntu 16.04 by running
Use Vagrant with Ubuntu Bash
- Add Windows executables to your Ubuntu
$PATH: `export PATH=$PATH:/mnt/c/Windows/System32/
- Test that Vagrant is callable by running
- Change directories to a location that's accessible to Windows (e.g.
- Clone a Vagrant-based project locally:
git clone https://github.com/geerlingguy/drupal-vm.git
- Change directories into the project dir:
Note that, currently, you can't run
vagrant.exe ssh from within Ubuntu Bash. You have to either use Cmder or a similar CLI for that, or run
vagrant.exe ssh-config, then run a manual SSH command (
ssh -p [port] email@example.com) to connect to your VM from within Ubuntu Bash.
I'm hopeful that Microsoft may be able to find ways to allow Windows executables (like Vagrant) see and use binaries in the WSL environment (e.g. Vagrant.exe can call out to Ubuntu's
ssh). In lieu of that, I wonder if Vagrant itself may be able to make some improvements to make it easier for Windows users to do things like
vagrant ssh and other esoteric commands without resorting to Cygwin.
I'm still working through some of these issues and trying to find the best path forward (especially for beginners) in the Drupal VM issue queue: Update docs for Windows with WSL Windows Interoperability improvements.
I've also left feedback in the Vagrant project's issue dealing with the WSL (Use Linux Subsystem on Windows), but I think as more developers start using Vagrant and WSL together, we may find clever ways of working around the current limitations.
You could also just run Linux or macOS as your desktop OS, and avoid these issues entirely ;-)