How to Enable Systemd for WSL2 in Windows 11. Several community-supported projects have been included in the Windows Subsystem for Linux (WSL), but systemd was one of the features that developers most frequently requested. Projects like one-script-wsl2-systemd and genie have already been created to put systemd on WSL2 in Windows 11 and 10. Given the popularity of systemd implementations for WSL2, Microsoft and Canonical, the company that publishes Ubuntu, have joined forces to officially support systemd for Windows Subsystem for Linux. And now, in just 5 simple steps, developers may enable systemd for WSL2 on Windows 11. So let’s learn how to activate systemd for WSL2 on Windows 11 if you’re interested.
How to Enable Systemd for WSL2 in Windows 11 (2022)
The steps to activate systemd for Windows Subsystem for Linux in Windows 11 are covered in this article, along with a brief introduction to the topic.
What is Systemd in Linux?
A system and service manager for Linux-based operating systems is called Systemd. It is essentially in charge of starting up system components and services when a Linux system boots. It is the parent process and initializes all other processes, therefore you might say that its PID (Process Identifier) is 1. What’s the big deal now that systemd is supported by Windows Subsystem for Linux?
First, systemd gives WSL a software environment that is practically native. In essence, what you get with an Ubuntu installation on bare metal, you get via WSL as well. In addition, a lot of services like Snap, microk8, Kubernetes, etc. depend on systemd to function effectively. Therefore, with official backing from Microsoft, developers can finally make the most of WSL2’s complete potential and work on both Windows and Linux at once without missing a beat.
Install the Latest Version of WSL2
- You must first download a certain version of WSL (Version 0.67.6 and above). To verify the current version, launch PowerShell and enter the command below. Go directly to the next section if you have an updated version.
- Download the most recent WSL package from Microsoft’s GitHub page using the link provided if you are using an older version of the software. For Windows 11, you can enable systemd for WSL2 without being on an Insider channel.
- Next, Install the MSIXBUNDLE Windows Subsystem for Linux package on your Windows 11 computer.
- Next, launch Windows Terminal as the administrator. Go directly to the next section if you already have a Linux distribution installed.
- Next, switch to PowerShell and issue the command listed below. The most recent Ubuntu distribution will be installed. If you want to install another Linux distribution, you can do so through the Microsoft Store or by running
wsl —install, which will list every option.
wsl --install Ubuntu
Enable Systemd for WSL2 in Windows 11
- After installing Ubuntu (or the Linux distribution of your choice), launch PowerShell once more with Administrator privileges. Then, click the arrow button in the title bar and select “Ubuntu.”
- Use the command listed below to change the “
wsl.conf” file using the Nano editor after choosing your username and password.
sudo nano /etc/wsl.conf
- Add the lines to the file that follows here. You may use this to make systemd available for WSL2 on your Windows 11 PC.
- Press “Ctrl + O” and hit Enter to save and leave the Nano editor. Press “Ctrl + X” to exit. You have now changed things as needed.
- You must now terminate the Windows Subsystem for Linux. Close the Ubuntu tab and switch to the PowerShell tab to do that. Run the command listed below here.
- At this point, start Ubuntu once more via the Windows Terminal. Now, Systemd will always be operating in the background. Run the command below to verify the status of the service.
systemctl list-unit-files --type=service
- Nextcloud may now be installed on WSL2 by utilising Snap, which needs systemd to work properly. In the second command, pick your own username and password. All of the Snap services are functioning as they should, as can be seen in the screenshot below.
sudo snap install nextcloud sudo nextcloud.manual-install USERNAME PASSWORD snap services
Turn on Systemd on Windows Subsystem for Linux
In order to enable systemd for WSL in Windows 11, you must take the procedures listed below. The nicest thing is that you can enable systemd in your Linux subsystem on Windows without switching to an Insider channel. You can immediately install the package by downloading it directly from GitHub.
Read More: What does Chmod 777 mean in Linux
Read More: How to Run Linux on a Chromebook