Skip to content

Instantly share code, notes, and snippets.

@macton
Last active November 5, 2023 02:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macton/a45b4af626d1641c3a85dad6927d259f to your computer and use it in GitHub Desktop.
Save macton/a45b4af626d1641c3a85dad6927d259f to your computer and use it in GitHub Desktop.

Cheatsheet for WSL2

Initial setup

Configure (.wslconfig, wsl.conf)

Update memory/swap

List containers (list, verbose)

wsl -l -v

Remove container

wsl --unregister container_name

Import container

wsl --import container_name storage_directory container_tarfile

Run/enter container

wsl -d container_name

Add to boot sequence for container startup

WSL mounted files in Explorer

\\wsl$\

Fix for warning/error "cuda not a symbolic link"

File permissions on mounted windows drives

Setup VPN

Create and attach ext4 vhdx image

Create distro launcher

Set default user

Problems

WSL import never completes

Sometimes a wsl --import command never completes. The vhdx file will be modified for many hours, but the actual import will not complete. Workaround is to copy files directly into an existing vhdx image.

Access is denied when launching distro

(Re-)Enable "Full Access" permission on VHDX image of distro.

Debugging WSLg

Install perf (Ubuntu)

$ apt install linux-tools-generic
$ rm /usr/bin/perf
$ ln -s /usr/lib/linux-tools/5.4.0-125-generic/perf /usr/bin/perf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment