Microsoft has released a new 0.67.6 version of its Windows Subsystem for Linux, which includes long-awaited systemd support.
The Windows Subsystem for Linux (WSL) is a compatibility layer that allows Linux binary executables to be run natively on Windows. It is a Windows feature that allows you to run Linux alongside your regular Windows desktop and programs.
In recent years, WSL has grown in popularity due to its simplicity and flexibility, reducing the need for Windows users to run an entire Linux virtual machine only to test some functionality.
However, due to the lack of some crucial components for any modern Linux system, such as systemd, WSL did not provide a completely functional Linux experience. Fortunately, that piece of the puzzle is finally in place.
Coincidence or not, this game-changing feature comes just over two months after systemd’s creator and a leading developer, Lennart Poettering, left Red Hat to join Microsoft.
Systemd on Windows Subsystem for Linux
The presence of systemd in WSL elevates the system to a whole new level, opening up many possibilities. For example, you can install a LEMP server in your WSL system and rapidly and easily develop web apps.
Moreover, if you use Ubuntu, you may now take advantage of the Snap package manager’s features. This was previously impossible due to the reliance on the availability of systemd.
Furthermore, we can continue by saying that MicroK8s can now be installed to allow you to run your Kubernetes cluster. So, as previously stated, this new functionality expands the possibilities tremendously.
Of course, not all Linux distributions use systemd, but most modern ones, including Debian, Ubuntu, Arch Linux, Fedora, openSUSE, and others, have adopted and relied on it.
So let me now show you how to update the WSL service on your Windows PC with systemd support capability.
How to Add Systemd Support to WSL?
Microsoft’s latest release for Windows Subsystem for Linux version 0.67.6 adds systemd support to WSL. Therefore, to get this functionality, you must first upgrade your WSL version.
An easy way to check your currently used WSL version is by running:
Remember, if that command fails, you are using the in-Windows version of WSL and must upgrade to the Store version.
Then, use the command below to update your WSL instance to the most recent version.
WSL may inform you that no new version is available. If this is the case, proceed with the instructions below to manually upgrade the WSL version.
After downloading the file, you can proceed with the installation. But first, you must stop the WSL service. Otherwise, the installation will fail.
So, open the service management console, highlight the “Windows Subsystem for Linux Preview” service, and then choose “Stop” from the right-click context menu.
Finally, open the Windows Power Shell console with administrative privileges (right-click, then “Run as administrator”) and execute:
Of course, replace the actual file path with the correct path for your system. After the installation is complete, start the “Windows Subsystem for Linux Preview” service.
Enable Systemd Support in a WSL Distro
So far, so good. Your WSL service now has systemd support. However, it is essential to remember that this does not automatically add one to your Linux instances.
In other words, manually enable it for each Linux distribution individually. Fortunately, this is very easy.
Inside the distribution itself, use your preferred text editor to open the
wsl.conf file located in the
/etc directory. If the file is not available, simply create a new one.
sudo vim /etc/wsl.conf
Paste in the following content, then save the file and exit.
Finally, close your WSL distro window, and in the Power Shell console, type the command below to restart your WSL instances:
That’s all. Your WSL distro should now have systemd support. Start the distro, and run the command below from its shell to test this functionality. The result should look like the one in the screenshot.
We hope we were of help. Any feedback on your WSL experience is welcome in the comments section below.