The Linux subsystem introduced in Windows 10 1609 brought some innovations in Windows 10 1809. Also new is that it is available on the server for the first time with version 2019. Because there is no Store app, you install it via the command line. This also applies to Windows 10 in the Long-Term Servicing Channel (LTSC).
Avatar

The Windows Subsystem for Linux (WSL) is intended for use on software developers' computers and for test environments. However, it is not suitable to run Linux applications for productive use. This is true even if you install WSL on the server.

Closer integration of WSL with Windows

The special advantage of the Linux subsystem is its close integration with Windows. This allows native Linux programs in Executable and Linkable Format (ELF) to start unmodified from the Linux shell. These programs can then access the file system of Windows and the network.

However, because of the differences between the systems and the architecture of WSL, constraints and inconsistencies are not entirely avoidable. This applies, for example, to accessing the hardware in the Linux environment, where the content of /dev is quite limited.

You can find almost only tty devices in WSL Ubuntu under :dev

You can find almost only tty devices in WSL Ubuntu under :dev

In contrast to Windows, Linux has case-sensitive file names. And it uses only \n for line breaks, while Windows uses \r\n. In addition, Linux has its own user and rights management.

The last update brought some improvements. Notepad can now correctly display line breaks in files created with Linux programs.

Notepad now preserves the type of line breaks

Notepad now preserves the type of line breaks

In addition, it is now possible not only to mount volumes as case-(in)sensitive but also to mark individual directories accordingly as well.

This is possible from within the WSL and also from Windows on volumes mounted with drvfs (e.g., the Windows C: drive under /mnt/c). On the Linux side, the commands used are getfattr (to display) and setfattr (to change). Under Windows, these commands serve the same purpose:

fsutil.exe file queryCaseSensitiveInfo <Path>
fsutil.exe file setCaseSensitiveInfo <Path> [enable | disable]
Querying whether a directory has been marked as case sensitive

Querying whether a directory has been marked as case sensitive

As a further integration of the WSL, holding down the Shift key and right-clicking on a directory with the mouse can now start the Linux shell directly from the File Explorer.

Starting the Linux shell from the File Explorer

Starting the Linux shell from the File Explorer

Since build 18342 of Windows 10 1903 you can now navigate through the directory tree of the Linux distribution with the Explorer. It is mounted under the UNC path \\wsl$.

You can display files in the Linux directories in the Explorer from Windows 10 1903 onwards

You can display files in the Linux directories in the Explorer from Windows 10 1903 onwards

Accordingly, you can also use this command in PowerShell to change to an Ubuntu installation:

cd \\wsl$\Ubuntu

In the newest version, the user has several Linux distributions to choose from. Initially only Ubuntu was available. Since the individual distributions are installed as Appx packages, you can run Ubuntu, Debian, and SuSE side by side.

Available Linux distributions for WSL in the Microsoft Store

Available Linux distributions for WSL in the Microsoft Store

WSL is still limited to programs for the command line because it doesn't include an X server. As a pure console environment, the subsystem can also function under Server Core. You can install one of the freely available X servers yourself, but there’s no support for this. If you need GUI programs for Linux, I recommend using a virtual machine.

Installing WSL

Adding a Linux environment is quite easy under Windows 10. Activate the feature in the Control Panel, restart the computer, and then fetch the desired distribution from the Microsoft Store.

Activating the Linux subsystem in the Control Panel

Activating the Linux subsystem in the Control Panel

If the WSL feature is not available for selection, you are probably using a 32-bit version of the OS instead of the required 64-bit version.

This procedure does not work for Windows 10 LTSC and Windows Server because the Store app is missing. Therefore, you have to download the Appx package and install it yourself.

There is no web browser available under Server Core, and you can only activate the feature via the command line. Hence you would use a pure PowerShell solution in this case, which of course also works everywhere else.

To add the subsystem in a PowerShell session with administrative privileges, issue this command:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Adding a Linux subsystem using PowerShell

Adding a Linux subsystem using PowerShell

Under Windows Server 2019, the following cmdlet works as well:

Install-WindowsFeature -Name Microsoft-Windows-Subsystem-Linux

Downloading a distribution

After the mandatory restart, you can download the desired distribution. You do not need administrative privileges to install the distribution because this takes place in the user's profile. The download links are:

You can use curl.exe or the Invoke-WebRequest cmdlet to download. For example, to get Ubuntu 18.04, you would enter this command:

Invoke-WebRequest https://aka.ms/wsl-ubuntu-1804 -out ubuntu.zip -UseBasicParsing

It then saves the Appx package as a .zip archive, so you don't have to rename the file extension subsequently. The UseBasicParsing switch allows PowerShell to bypass Internet Explorer.

Downloading and unpacking Ubuntu 18.04 for WSL in PowerShell

In the next step, you unpack the .zip file by typing this command in the desired installation directory:

Subscribe to 4sysops newsletter!

Expand-Archive .\ubuntu.zip
Installing Ubuntu 18.04 for WSL

Installing Ubuntu 18.04 for WSL

Now change to the folder ubuntu and execute ubuntu1804.exe. The following process takes a few minutes, and after creating a user and selecting a password, you will end up at the prompt of the Linux shell.

avataravataravataravatar
5 Comments
  1. Avatar
    Scott 4 years ago

    When I follow these instructions for Kali Linux, I don't see a "kali.exe" or any other EXE when I extract the ZIP file.

  2. Avatar
    Jason 4 years ago

    No idea if this will get any response, but here it goes:

     I am running Win10 Enterprise LTSC 1809, Build 17763.1098
    I followed the steps above up to the point of running ubuntu1804.exe. When I run it in powershell under administrator I get the following error:

    ubuntu1804 : mesg: ttyname failed: Inappropriate ioctl for device
    At line:1 char:1
    + ubuntu1804
    + ~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (mesg: ttyname f…octl for device:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError"

    It just hangs after I hit ctrl+break, and all I can do is close the powershell and open it again. Any clue why this might be happening?

  3. Avatar
    Kami 4 years ago

    I've not been able to get this working. I'm sure I have WSL done. I have either silent errors when running the registered appx of wsl-ubuntu or 'path/network not found' errors from Powershell when running the exe.

    Anyone have any advice? Perhaps some resources/tutorials.

  4. Avatar
    Phong Nguyen 4 years ago

    Once i run ubuntu.exe –> I received the message: Access Denied

    How to solve it ?

    • Avatar
      marcelo 7 months ago

      try to run the .exe as an Administrator

Leave a reply

Your email address will not be published. Required fields are marked *

*

© 4sysops 2006 - 2023

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account