Microsoft quietly releasing systemd for Windows 11 WSL2

For those of us who have been using WSL for a long time, we have all been quite frustrated by the lack of a functioning systemd. I’ve personally resorted to a package called systemd-genie that did some gymnastics to fool WSL into thinking it had booted properly (with systemd at PID 1). This mostly worked but was exceedingly brittle. Trying to remember whether you were in or out of the bottle was a pain (VS Code integrated terminal – out of the bottle). I changed my shell to always be in the bottle, but it just didn’t quite work out.

To my surprise, I was following through my WSL setup instructions with another developer, and pointed him at systemd-genie, only to find the message on the page: Microsoft is previewing the completed systemd!

So. The bad news. Your WSL installation is probably borked beyond repair if you’ve been using systemd-genie or similar. Back it up and blow it away. Get the latest release from the [Microsoft WSL Github repository](https://github.com/Microsoft/WSL/releases). Run wsl –update to get the latest updates, and install one or more distributions from the Microsoft store. Boot the distribution, and edit the file /etc/wsl.conf. Add the lines:

[boot]
systemd=true

Restart the distribution. When you boot back up, you’ll find that systemd is now running. Try snap install … or start some services with systemctl. It’s been a long journey, but Microsoft Windows 11 is now Linux!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: