- SystoLOCK in review: Logging in to Active Directory with multi-factor authentication without passwords - Tue, Dec 5 2023
- New Group Policy settings in Windows 11 23H2 - Mon, Nov 20 2023
- Windows Server 2025 will support SMB over QUIC in all editions - Fri, Nov 17 2023
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.
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.
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]
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.
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$.
Accordingly, you can also use this command in PowerShell to change to an Ubuntu installation:
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.
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.
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.
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
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:
- Ubuntu 18.04: https://aka.ms/wsl-ubuntu-1804
- Ubuntu 18.04 ARM: https://aka.ms/wsl-ubuntu-1804-arm
- Ubuntu 16.04: https://aka.ms/wsl-ubuntu-1604
- Debian GNU/Linux: https://aka.ms/wsl-debian-gnulinux
- Kali Linux: https://aka.ms/wsl-kali-linux
- OpenSUSE: https://aka.ms/wsl-opensuse-42
- SLES: https://aka.ms/wsl-sles-12
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!
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.