After about two months from the last post in this thread, now I am using WSL 2 extensively, and I know a lot more about it.
Virtual machines with Linux, either with command-line only, or with installed desktop environments that run on X.Org or Wayland, can not be used in WSL 2, because:
WSL 2 provides its own Linux kernel, a Wayland compositor named Weston, XWayland for running X.Org programs, and a PulseAudio server.
Linux distributions running in WSL 2, are in container form only, they can not have their own Linux kernel, and must not run their own X.Org server, Wayland compositor, or PulseAudio server.
Linux containers provided in:
linux containers
are very suitable to run in WSL 2.
A Windows program named Distrod:
distrod
can download and convert Linux containers from that site, to WSL 2 containers, automatically.
You just run the distrod_wsl_launcher.exe, and you get a list with the available Linux containers:
These WSL 2 containers, run systemd, in contrast with the Microsoft Store official Linux containers, that do not.
When you want to install a GUI program in a WSL 2 Linux instance (container), in Windows 11, so as to run it from the Windows 11 Start menu,
you just install the application itself directly, and not a desktop environment.
Assuming you have an Ubuntu instance, an example:
sudo apt install firefox
Another useful information:
Prefer the Microsoft Store installation of WSL 2 itself, in Windows 11, because it gets updated more frequently, together with the latest versions of WSL 2 Linux kernel and WSLg.
For more information, refer to:
WSL 2 in Microsoft Store
Using Distrod, I have installed Arch Linux container in WSL 2:
I suggest to begin with an Ubuntu instance (container), or some other Linux distribution you know how to use, to get accustomed to WSL 2.
Useful links:
WSL 2 site:
Releases · microsoft/WSL
GitHub - microsoft/WSL: Issues found on WSL
WSL 2 Linux kernel site:
Releases · microsoft/WSL2-Linux-Kernel
GitHub - microsoft/WSL2-Linux-Kernel: The source for the Linux kernel used in Windows Subsystem for Linux 2 (WSL2)
WSLg (it allows to run GUI Linux programs like Firefox in Windows 11, together with Windows 11 Start menu integration):
GitHub - microsoft/wslg: Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
WSL 2 installation from the Microsoft Store, instead of installing it from within Windows 11:
A preview of WSL in the Microsoft Store is now available! - Windows Command Line
Distrod:
Releases · nullpo-head/wsl-distrod
GitHub - nullpo-head/wsl-distrod: Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.