🅭

A quick look into LxRun.exe: Windows 10’s new Linux-installer

Microsoft announced its new Windows Subsystem for Linux (WSL) last week at their //BUILD developer conference. Just a short week later, and they’ve already started shipping the feature to early adopters in the Windows Insider program! I haven’t had much time to play with it yet, but I took a closer look at their fascinating new beachhead installer for Linux.

LxRun.exe is available after you enabled the Windows Subsystem for Linux as an optional feature for Windows 10. As with Hyper-V virtualization and other subsystems for “professional users of Windows”, WSL isn’t available as an Optional Feature in the Settings app: System: Apps and Features, but only through Control Panel: Programs: Turn Windows features on and off. So, much for abolishing the Control Panel.

You can run LxRun.exe in one of two ways:

  • Press Start, search for Bash, and launch it; or
  • Open Command Prompt and run LxRun.exe /install

Both methods will ask you whether you want to install “Ubuntu on Windows, distributed by Canonical”. If you accept the license (as of the time of publication this is the unmodified standard Ubuntu service license) it will install the Ubuntu 14.04 Long-Term Support userland and binaries.

The wording here’s interesting as Microsoft claims it’s being “distributed by Canonical” — the company behind Ubuntu. However, after accepting the license and starting the download it will say “Downloading from the Windows Store…” Neither of these conflicting statements appears to be true, as two files will be downloaded from Microsoft’s Azure server hosting solution. The Windows Store doesn’t seem to be involved at all except for the name-dropping.

The two files being downloaded are:

https://go.microsoft.com/fwlink/?LinkID=730581
# trusty-server-cloudimg-amd64-root.tar.gz
https://go.microsoft.com/fwlink/?LinkId=747853
# ubuntu.ico

The compressed archive downloads in 188 MiB, doesn’t contain the Linux kernel nor anything too interesting besides the base Ubuntu system, and installs in 527 MiB.

The installer then unpacks the downloaded ubuntu.tar.gz file (something Windows Shell still can’t do natively) into %LOCALAPPDATA%\lxssrootfs. This folder is a hidden system folder to protect its contents. A few aliases for the Linux home directories at /home and /root are created in the non-hidden parent folder at %LOCALAPPDATA%\lxss to facilitate easy file sharing between Linux and Windows. This also means the installation happens in each user’s home folder; creating instance isolation on shared systems.

The second file is a high-quality multi-sized ubuntu.ico file used to create an entry for “Bash on Ubuntu on Windows” in the Start menu.

There are also some other commands available from LxRun:

lxrun.exe
Performs administrative operations on the LX subsystem
Usage:
    /install - Installs the subsystem
        Optional arguments:
            /y - Do not prompt user to accept
    /uninstall - Uninstalls the subsystem
        Optional arguments:
            /full - Perform a full uninstall
            /y - Do not prompt user to accept
    /update - Updates the subsystem
        Optional arguments:
            /critical - Perform critical update. This option will close all running LX processes when the update completes.

The /update argument is somewhat interesting. It literally invokes Bash and runs the well-known command sequence apt update && apt dist-upgrade -y! I’d never thought I’d live to see the day Microsoft would include a wrapper for good old apt in as a Win32 executable in Windows!

Other things of note are the new “LxssManager” service that describes itself thusly: “The LXSS Manager service supports running native ELF binaries. The service provides the infrastructure necessary for ELF binaries to run on Windows. If the service is stopped or disabled, those binaries will no longer run.”

The Windows Subsystem for Linux doesn’t look like it’s still in an early stage of development for this feature — despite what Microsoft would have us believe. It’s branded as a beta and not an alpha or pre-release. Most basic things seem to be working remarkably well in Bash.

This article was written based on Windows Insider build 14316, which was the first build that enabled WSL for early adopters. To my great surprise, Windows Subsystem for Linux isn’t limited to Windows 10 Professional and Enterprise but is at least for now also available for Windows 10 Home.

I’m personally very pleased to see Bash and the Linux userland coming to Windows! I use the GNU/Linux toolset every day and having access to it on Windows will definitely improve my everyday workflow.