How to Enable systemd in WSL2
A complete walkthrough turning on systemd support in a WSL2 distro — configuration, the required restart, and verifying services actually manage correctly afterward.
systemd support arrived in WSL2 in September 2022 as an opt-in feature — this walks through actually enabling and verifying it.
Step 1: check your current WSL version supports it
wsl --version
Confirm you’re on a sufficiently recent WSL version — if the version looks old, update first.
Step 2: update WSL if needed
wsl --update
Step 3: edit the distro-specific configuration file
sudo nano /etc/wsl.conf
Add or edit the following section:
[boot]
systemd=true
This setting is per-distro, configured from inside the specific distro you want systemd enabled for — it doesn’t affect other installed distros.
Step 4: fully restart the distro for the change to take effect
wsl --shutdown
Then relaunch the distro normally. A simple exit and reopening the terminal is not sufficient — the full shutdown command is required since this changes how the distro’s own init process boots.
Step 5: verify systemd is actually running as PID 1
ps -p 1
This should show systemd as the process running with PID 1 — if it shows something else (like /init or a shell), the setting either wasn’t applied correctly or the required restart didn’t happen.
Step 6: verify systemctl actually works
systemctl status
systemctl list-units --type=service
A working systemd setup shows genuine service status output here, rather than the “System has not been booted with systemd” error that appears without systemd support enabled.
Step 7: test starting and stopping an actual service
sudo systemctl start nginx
sudo systemctl status nginx
sudo systemctl stop nginx
Confirming a real service starts, reports correct status, and stops cleanly verifies systemd is genuinely functional, not just present.
Step 8: enable a service to start automatically with the distro
sudo systemctl enable nginx
With systemd properly running, standard service auto-start configuration behaves exactly as it would on a conventional systemd-based Linux installation.
Step 9: troubleshoot if systemd doesn’t appear to be running after the restart
Double-check the /etc/wsl.conf edit was saved correctly, confirm wsl --shutdown was actually run (not just closing the terminal window), and confirm you’re editing the config file inside the correct distro if you have multiple installed.
Why this specific opt-in step, rather than automatic enablement, exists
Enabling systemd changes a distro’s fundamental boot behavior — making it an explicit, per-distro opt-in avoids silently changing how existing distro configurations boot, protecting setups that were specifically configured to work without systemd from an unexpected, disruptive change to their startup behavior.