Resolved (at least with a workaround) in the comments. And I've now seen what seem to be 3 related questions in the last week about this, so there may be significant issue.
I believe there's a common theme of:
- Recent update of WSL2 to 2.1.5 (or 1 previous beta)
- Systemd being enabled
- Non-Ubuntu (perhaps non-Debian) distribution
If you don't have at least the first two of these, then you are probably looking at a different issue. I'm guessing it's possible for the problem to occur on Ubuntu, but something about the current Systemd loading order on that distro appears to be working to avoid the issue for the most part.
For this particular quetion, the issue was caused when running Systemd inside Arch on WSL2 release 2.1.4, and the issue resolved when disabling Systemd.
That leads up to ...
Option 1: Disable Systemd
If you do not need Systemd in WSL. Run:
sudo -e /etc/wsl.conf
If you have:
[boot]
systemd=true
Then either comment out the system line or set it to false.
Shutdown WSL (or terminate the instance) and restart. This can be done via PowerShell with:
wsl --shutdown
Option 2: Create a link for the X11 socket
If you still need or want to run Systemd, there's another answer here on Super User with a solution that I believe is likely to resolve the issue. The solution from that answer is to:
rmdir /tmp/.X11-unix && ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix
That answer also includes a Systemd unit to automatically handle this on every boot. However, I do recommend occasionally checking to see if there are reports of the issue being fixed, so that you can stop this manually linking in the future. It's possible (but not expected) for this to interfere with other behavior.
For reference, this answer (currently closed, but will probably be Roomba'd at some point) is another case, with a WSL update, OpenSUSE Tumbleweed, and Systemd enabled. Disabling Systemd also resolved that case.