Mike Levin SEO

Future-proof your technology-skills with Linux, Python, vim & git... and me!

← On Being Unstoppable, APIs & LXD / LXD Under WSL2 (Success!)
LXD Linux Containers in Windows Linux WSL2, But What Is Home? →

Get LXD Running Under WSL2 on Windows 11 with Ubuntu 18.04

by Mike Levin

Thursday, June 23, 2022

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

https://github.com/nullpo-head/wsl-distrod

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):

Category: linux

← On Being Unstoppable, APIs & LXD / LXD Under WSL2 (Success!)
LXD Linux Containers in Windows Linux WSL2, But What Is Home? →