Felix Itzenplitz
de

WSL2: Enabling systemd in Ubuntu 22.04

Issued
Extent
1 min read · 134 words
By
Felix Itzenplitz
Also in
Deutsch

Since Ubuntu 22.04 it is possible to use systemd in an experimental state on WSL installations. This guide explains how you can easily set it up in just a few steps.

Setup Guide

  1. Install wsl-setup package, if its not already there.
sudo apt install wsl-setup
  1. Create a /etc/wsl.conf file ( WSL Configuration Documentation (opens in a new window) ):

For WSL comes with Windows 10/11:

[boot]
command="/usr/libexec/wsl-systemd"

For WSL Preview from MS Store in Windows 11:

[boot]
systemd=true
  1. Create /run/users/1000 and set user rights (optional: but was needed for snapd):
sudo mkdir -p /run/users/1000
sudo chown $USER:$GROUP /run/users/1000
  1. Relaunch wsl with following command from windows or set as launch option in your terminal:
wsl -e /usr/libexec/nslogin /bin/bash

Official Ubuntu Bug Report (opens in a new window)
Install Snippet (opens in a new window)