WSL2 now natively supports
systemd in Windows 11 as well as Windows 10. Although you need to explicitly enable systemd and WSL2 ends up consuming more system memories and resources, we recommend enabling systemd if your version of Ubuntu is 22.04 or later. Ubuntu seems to be getting more dependent on systemd and its related services and daemons. For example, if you want to install Firefox in one of those recent Ubuntu versions, you need to have its
snap command working and that requires
snapd as well as systemd. When you enable systemd, all those dependencies are automatically installed and configured; those newly added services and daemons also create a more consistent and complete Linux GUI environment for your WSL2 sessions.
If the apps you want to use via WSL2 don't require systemd or you want to configure WSL2 with a minimal set of services and daemons, we recommend at least enabling D-Bus as outlined in the following post. When you enable systemd, you don't need to separately configure D-Bus; it's automatically configured and ready for your WSL2 sessions when you just enable systemd as mentioned above.
Sharing D-Bus among WSL2 Consoles
We prepared this post to help our X410 users who want to set up an Ubuntu GUI desktop environment in WSL2 with systemd enabled. However, overall steps for setting up the GUI desktop should also be similar for other X-Window servers for Windows.
We will be setting up a full Ubuntu desktop environment with X410 in its Floating Desktop mode. X410 also has Windowed Apps mode that allows Linux GUI apps to seamlessly run side by side with Windows apps. For more information about enabling systemd and running Linux GUI apps in Windowed Apps mode while maintaining their UI consistency in Ubuntu GUI desktop theme (colors, icons etc.), please read the following post.
Enable systemd and simplify running Linux apps like Windows apps in Ubuntu GUI style
In this post, you should also be able to find additional information about avoiding the problems that might occur while installing and setting up an Ubuntu desktop. We also have included examples of scripts and batch files that can simplify starting your Ubuntu desktop directly from Windows.
The device we used for preparing this post showed the following information for WSL.
C:\> wsl --version
WSL version: 126.96.36.199
Kernel version: 188.8.131.52
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.1555