The Windows 10 Creators Update is set for release shortly, and comes with significant improvements to the Windows Subsystem for Linux, also known as Bash on Windows or Ubuntu on Windows.
Just to remind you, this is not done via emulation, nor by running a virtual machine, but rather by redirecting system calls.
Does Microsoft really love Linux? While that is hard to answer definitively, the company does see a lot of Linux in its future, and is smart enough not to resist it.
Around a third of VMs on Azure run Linux; SQL Server for Linux is coming; the next-generation .NET platform (.NET Core) runs on Linux; Visual C++ can target Linux in Visual Studio 2017 (to be released shortly); and via Xamarin you can compile mobile applications for Linux-based Android, to mention a few examples of how Linux has now permeated Microsoft’s platform.
What’s the point of the Windows Subsystem for Linux (WSL)? Microsoft mainly has developers in mind. If you are developing for web or mobile platforms, Windows gets in the way, with annoyances like MAX_PATH (a 260 character limit on path length that messes up tools like Java and Node.js), a different character used as the path separator, and the simple fact that most open source tools are compiled for Linux first with a Windows port as an afterthought or not at all. Life is easier on Macs, since OS X is UNIX-based.
You will still need a Mac to target iOS or the Mac itself, but Microsoft hopes that WSL will remove most of the other obstacles.
Although still in beta, WSL gets important new features in the Creators Update. One is better interop between Windows and Bash. You can run a Linux command from a Windows command prompt simply by typing:
bash -c [Linux command]
You can also run a Windows executable from Bash simply by typing the full path and command.
Network commands like
ifconfig now work as expected. The console has mouse support and 24-bit colour. And numerous bug-fixes and new system calls mean that more things work, including languages such as Go, Ruby, Java and Node.js. Ubuntu 16.04 (Xenial) is now installed by default.
The Creators Update runs SSH (secure shell server) and GDB (GNU Debugger) more reliably, and you can now configure WSL as the remote target for Visual C++ for Linux. In this scenario, Visual C++ is the editor and visual debugging tool, though compile and build is on the “remote” Linux system, which in this case is WSL. It’s a neat feature, though not yet as reliable as using a Linux VM or remote Linux PC.
You can compile and debug Linux applications entirely with Visual Studio on Windows 10 (click to enlarge)
Another notable feature is the ability to run Ubuntu desktop. This is not yet an official part of the platform, and does require installation of a separate Windows X server (we used VcXsrv), but on a well specified PC it works well. You can use it together with Windows 10 multiple desktop support, so that you have Linux on one desktop and Windows in another. If Microsoft chooses to go further in this direction, it is not much of a stretch to imagine Linux GUI application support integrated into Windows 10.
Is WSL good enough for real work? Opinions vary. “I use it to fix line endings and extract tar files pretty regularly,” says Joe Gardiner, a senior solutions architect at Chef. For this kind of use, WSL is excellent and removes friction for developers.
On the other hand, John Grant, founder of IT Jobs Watch in the UK, says that “Bash on Ubuntu on Windows doesn't support Nginx. So for development it's not that useful. A remote XenServer is more flexible … next version perhaps.”
Grant has yet to try the Creators Update, so it is possible that as the platform improves his view may change. A quick test on the latest build shows that Nginx installs and runs without obvious issue.
Nginx running on Windows Subsystem for Linux
WSL is excellent work, but the snag is that it has to be good enough that developers do not find themselves asking, “is this a bug in my code, or in WSL?”, if its usage is to go beyond simple utilities.
The stakes are high for Microsoft, since if most developers end up using Mac or Linux PCs, it is less likely that things such as the Universal Windows Platform (UWP), Azure, or Visual Studio Online will catch their attention.
Microsoft does now have cross-platform tools such as Visual Studio Code and Visual Studio for the Mac, but nothing close to the sophistication of Visual Studio on Windows. ®