How to Enable Systemd For WSL2 in Windows 11 2024

As a developer or a Linux enthusiast, you may be familiar with the seamless integration of Windows Subsystem for Linux (WSL) into the Windows operating system. With the release of Windows 11, Microsoft has introduced significant improvements to WSL, including the ability to enable Systemd for WSL2. In this article, I will guide you through the process of enabling Systemd for WSL2 in Windows 11, allowing you to take full advantage of its features for managing system processes.

What is Systemd in Linux?

Systemd is a system and service manager for Linux operating systems that has become the de facto standard for managing the system and services. It is responsible for initializing the system components, managing system processes, and controlling the startup and shutdown of the system. Systemd provides a range of advanced features, including parallelized startup processes, on-demand starting of daemons, dependency-based service control, and more. By enabling Systemd for WSL2 in Windows 11, you can harness the power of this robust system management tool within your WSL environment.

Install the Latest Version of WSL2

Before enabling Systemd for WSL2 in Windows 11, it is essential to ensure that you have the latest version of WSL2 installed on your system. To do this, follow these steps:

  1. Open the Windows Settings app by clicking on the Start menu and selecting “Settings.”
  2. In the Settings window, click on “Apps” and then select “Optional Features.”
  3. Locate and select “Windows Subsystem for Linux” from the list of optional features.
  4. Click on “Install” and follow the on-screen instructions to install WSL2.

Once you have successfully installed WSL2, you are ready to proceed with enabling Systemd for WSL2 in Windows 11.

Enable Systemd for WSL2 in Windows 11

Enabling Systemd for WSL2 in Windows 11 involves a series of steps to configure your WSL environment to use Systemd as the init system. Follow these instructions to enable Systemd for WSL2:

  1. Open PowerShell with administrative privileges by right-clicking on the Start menu and selecting “Windows PowerShell (Admin).”
  2. Run the following command to set WSL2 as the default version: wsl --set-default-version 2.
  3. Next, download the Systemd init script using the following command: curl -o /tmp/
  4. Run the script to install Systemd for WSL2: bash /tmp/

Once you have completed these steps, Systemd will be enabled for WSL2 in Windows 11, allowing you to utilize its powerful features for managing system services and processes within your WSL environment.