« Previous 1 2 3 Next »
Windows Subsystem for Linux and Android in Windows 11
Good Host
WSLg in Action
After the obligatory reboot, you can install a Linux distribution (e.g., Ubuntu, Kali Linux) from the Microsoft Store and then find it in the Start menu. When called for the first time, WSL opens and initializes a shell for the Linux instance and prompts you to specify a user and a password. This account is independent of your Windows user account and only exists within this Linux instance.
The usual shell commands let you update Linux and install graphical applications, such as the Gnome text editor or even the Mozilla Firefox web browser:
sudo apt update sudo apt upgrade sudo apt install gedit -y sudo apt install firefox -y
When you're done, you can see for yourself that graphical applications not only launch from the shell but also show up as subfolders in the respective Linux distribution in the Start menu (Figure 2). WSL has caught up with Google ChromeOS and seamlessly integrates Linux apps into the Windows interface.
File exchange between the two worlds is bidirectional. You can access all your Windows drives in WSL as mountpoints (e.g., /mnt/c
and /mnt/d
). On Windows, you will find the root filesystems of all your installed distributions in subfolders of the \\wsl$
virtual network share.
If you need graphical tools that do not exist as native applications for Windows or if you develop ML/AI use cases with Linux as the target platform, WSL on Windows 11 is a useful tool.
systemd
The systemd init system has become more or less the standard in most distributions. Unfortunately, at the time of writing this article, in contrast to a full-fledged Linux VM, WSL did not have systemd and the common commands like systemctl
. Since then, systemd for WSL has been released [6], which will allow you, for example, to start the classic trio of daemons for a web server, script interpreter, and database (e.g., Nginx, PHP, and MySQL).
USB Support over the Network
Maybe you need a smartcard reader or you develop IoT applications and want to configure a microcontroller over USB. In this case, you will unfortunately notice that WSL cannot communicate directly with USB devices connected to Windows at the present time. An indirect approach involving the USB/IP network protocol will help you. In the past, you had to make complex adjustments to the Linux kernel to do this. But on Windows 11, current instances of WSL 2 from kernel version 5.10.60.1 upward do this by default.
To begin, install the latest version of usbipd-win
as described on the project's GitHub page [7] with a winget
command or as an MSI package. Now launch a Linux distribution and install the appropriate tools for USB/IP there, too [8]:
sudo apt install linux-tools-5.4.0-77-generic hwdata sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/5.4.0-77-generic/usbip 20
On the Windows side, list all the available USB devices from an admin command line and connect them to the Linux environment:
usbipd wsl list usbipd wsl attach --busid <ID>
Another list
command shows that the device is connected. On the opposite side on Linux, the lsusb
command should confirm this, as the smartcard reader example demonstrates (Figure 3). After completing these steps, you can detach the device again with the command:
usbipd wsl attach --busid <ID>
In this way, the WSL can be useful for low-level development, as well.
« Previous 1 2 3 Next »
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.