Enable Systemd for WSL2 in Windows 11 (2022)
In this tutorial, we have mentioned the instructions to enable systemd for Windows Subsystem for Linux in Windows 11 along with a quick explainer on the subject.
What is Systemd in Linux?
Systemd is a system and service manager for Linux-based operating systems. It’s essentially responsible for launching system components and services during the booting of a Linux system. You can say that it’s the parent process and initializes all other processes, hence, its PID (Process Identifier) is 1. So what is the big deal now that Windows Subsystem for Linux supports systemd?
First, systemd brings an almost near-native software environment to WSL. Basically, what you get from Ubuntu on a bare-metal installation, you get the same environment in WSL as well. Apart from that, there are many services like Snap, microk8s, Kubernetes, etc., that rely on systemd to work properly. So with official support from Microsoft, developers can now fully utilize WSL2 ‘s true potential and work on Windows and Linux simultaneously without missing out on anything.
Install the Latest Version of WSL2
- First, you need to download a particular version of WSL (Version 0.67.6 and above). Open PowerShell and run the below command to check the current version. If you have an updated version, move straight to the next section.
- If you are on an older version, go ahead and download the latest WSL package from Microsoft’s GitHub page linked here. You don’t need to be on an Insider channel to enable systemd for WSL2 in Windows 11.
- Next, install the Windows Subsystem for Linux MSIXBUNDLE package on your Windows 11 PC.
- After that, open Windows Terminal with Administrator privileges. If you already have a Linux distro installed, move straight to the next section.
- Next, move to PowerShell and run the below command. This will install the latest Ubuntu distribution. If you want to install any other Linux distro, you can install it from the Microsoft Store or run wsl –install to find all the available distributions.
Enable Systemd for WSL2 in Windows 11
- Once Ubuntu (or your choice of Linux distro) is installed, open PowerShell again with Administrator privilege. Then, move to “Ubuntu” from the arrow button in the title bar.
- After setting your username and password, run the below command to edit the “wsl.conf” file using the Nano editor.
- Here, add the below lines to the file. This will let you enable systemd for WSL2 on your Windows 11 computer.
- To save and exit from the Nano editor, press “Ctrl + O” and hit Enter. After that, press “Ctrl + X”. You have now made the necessary changes.
- Now, you need to shut down Windows Subsystem for Linux. For that, close the Ubuntu tab and move to the PowerShell tab. Here, run the below command.
- Now, go ahead and launch Ubuntu again from the Windows Terminal. Systemd will now be running in the background by default. To check, run the below command and see the service status.
- You can now install Nextcloud on WSL2 using Snap, which relies on systemd to function properly. Here, choose your own username and password in the second command. As shown in the screenshot below, all the Snap services are running properly.
Turn on Systemd on Windows Subsystem for Linux
So these are the steps you need to follow to enable systemd for WSL in Windows 11. The best part is you don’t need to move to an Insider channel to enable systemd in your Linux subsystem on Windows. You can directly download the package from GitHub and install it right now. Moreover, if you want to install Android apps on Windows 11, head to our detailed tutorial. And to install Google Play Store on your Windows 11 PC, we have an updated guide for you. Finally, if you have any questions, let us know in the comment section below.