Future-proof your skills with Linux, Python, vim & git as I share with you the most timeless and love-worthy tools in tech through my two great projects that work great together.

Get LXD Running Under WSL2 on Windows 11 with Ubuntu 18.04

Learn how I got LXD running on Windows 11 with Ubuntu 18.04. I'll show you how to download the install.sh file, enable systemd, and test if it's running. Plus, I'll share how to fix failed attempts and start fresh. Get all the steps you need to get LXD up and running today.

Get LXD Up and Running on Windows 11 with Ubuntu 18.04

By Michael Levin

Thursday, June 23, 2022

Teach how to get LXD under WSL2 running, easy peasy!


To enable systemd on an existing WSL2 installed Linux:

curl -L -O "https://raw.githubusercontent.com/nullpo-head/wsl-distrod/main/install.sh"
chmod +x install.sh
sudo ./install.sh install

And then enable it:

/opt/distrod/bin/distrod enable

Test whether systemd is running:

ps --no-headers -o comm 1

If that prints “systemd” you’re all set to install lxd!

If there had been failed attempts:

sudo apt purge lxd
sudo rm -rf /var/lib/lxd

If a fresh attempt:

sudo apt install lxd
sudo lxd init
(yes all the way through wizard)

Reboot. wsl –shutdown from Powershell

lxc launch images:ubuntu/18.04 u1804a
lxc exec u1804a -- su --login ubuntu

Keep this in mind for sharing volumes from pool:

lxc storage volume create default blah
lxc config device add c1 blah disk pool=default source=blah path=/blah
lxc config device add c2 blah disk pool=default source=blah path=/blah

There’s also advice on sharing host volumes (including home):