Installation

Windows

wsl --install
wsl --update

Usage

# Install a distro
wsl --install -d <distro-name> --name <custom-name>
# List all distros
wsl --list --all --verbose
 
# List distros available to install
wsl --list --online
# Shutdown specified distro
wsl --terminate <distro-name>
 
# Shutdown all running distros
wsl --shutdown
# Uninstall an existing distro
wsl --unregister <distro-name>
# Update WSL
wsl --update

Troubleshoot

Network

Blocked by WireGuard

The host machine have wireguard running
The WSL is unable to connect to the internet

Update WireGuard Allowed List
WireGuard → Tunnel → Edit
Untick “Block untunneled traffic (kill-switch)”

Previous Value
AllowedIPs = 0.0.0.0/0, ::/0
New Value
AllowedIPs = 0.0.0.0/1, 128.0.0.0/1, ::/1, 8000::/1

Config

Path

By default WSL will add current Windows Path
Open /etc/wsl.conf inside the distribution
Update appendWindowsPath to false to disable this setting.

[interop]
appendWindowsPath=false

Network

By default WSL will use NAT networking mode
Open $HOME/.wslconfig in host machine
Update appendWindowsPath to false to disable this setting.

[wsl2]
networkingMode=mirrored

Startup

To start WSL during Windows startup

@'
pwsh -c "clear; wsl -d NixOS --cd \"~\""
'@ > "$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\startup-wsl.bat"

Appendix