Hands-on test of Windows Subsystem for Linux
Undercover
The new Linux subsystem [1] has been around since the Windows 10 Creators Update; according to Microsoft, it can get by without a resource-consuming virtual machine (VM) and configuration. It is also said to offer a more native Linux feeling than the previous Cygwin [2] Linux environment. Linux users have used Cygwin on Windows for years, for example, to automate processes with shell scripts (e.g., mass Git checkouts), but it does mean recompiling Linux programs for Windows.
A look at the subsystem is worthwhile because of the surprisingly lightweight, process-based virtualization concept that just might catch on. In this article, I explain the limitations of the subsystem compared with native Linux and Cygwin, and I offer a number of customization tips that help make the subsystem fit for everyday use.
Installation
Users of Windows 10 Professional, at least, will be able to pick up the Linux subsystem easily. The subsystem runs natively on Windows and does not require an additional VM. If you do not want to create a Microsoft account during the install, you can install Ubuntu 16.04 LTS directly by using Windows PowerShell. As an administrator, the command
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
prepares Windows for installing the subsystem (Figure 1, top). Next, select Settings | Update & Security | For developers
to enable Developer mode
(Figure 2). Once the installation is complete, type bash
to display the prompt (Figure 1, bottom). Like all applications under Windows, the bash shell shown in Figure 3 is launched from the Start menu by calling bash.exe
.
Home Is Home
After double clicking on bash.exe
, you will find yourself in a Linux shell with an Ubuntu environment. Even the Apt package manager is there waiting for you. Windows saves the subsystem files under C:\Users\<pa>\AppData\Local\lxss
. Conversely, Ubuntu mounts Windows under /mnt/c
.
To save typing and avoid redundant data structures, it is best to merge the Linux and Windows home directories first. For this purpose, change the path to your Linux home directory in the /etc/passwd
file so that it points to your Windows home /mnt/c/users/<pa>
. The Vi editor, which you call by typing sudo vi /etc/passwd
, helps you do this on Windows. After restarting Bash.exe
, you land directly in the Windows home directory.
Startup Problems
Differences from a native Linux system are already apparent with the use of a user-specific C:\Users\<pa>\AppData\Local\lxss
path: In contrast to the normal procedure, the services that Ubuntu usually links in the /etc/init.d
directory do not start up automatically at boot time. They also terminate along with the shell. Although the Apache web server can be configured in the usual way, you have to boot it manually every time. After closing Bash.exe
, it cannot be reached at all.
A command to register a Linux service under Windows (e.g., cygrunsrv
under Cygwin) does not yet exist for the new subsystem. However, you can live with this restriction, because you will always open a shell to start work.
Buy this article as PDF
(incl. VAT)
Buy ADMIN Magazine
Subscribe to our ADMIN Newsletters
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Most Popular
Support Our Work
ADMIN content is made possible with support from readers like you. Please consider contributing when you've found an article to be beneficial.