I'm mostly very happy with WSL2 on Windows 10, having just switched from Mac. I run X410 on the Windows host and start X11 apps inside WSL by setting

export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }'):0.0

before starting my program.

It works fine for a while, but after my computer wakes up from sleep, the X window is gone. The application is still shown as running in ps.

I have a feeling it has to do with losing network connection between the X11 app and the X410 server, but I'm not sure. Has anyone experienced this and come up with a workaround?

I'm on Windows 10 Insider Preview build 18945.

  • Did you try other X servers like Xming, VcXsrv, cygwin-x etc.?
    – Biswapriyo
    Aug 23, 2019 at 15:27
  • @Biswapriyo, yes I have the same behavior on Xming.
    – andreas
    Aug 23, 2019 at 16:56

3 Answers 3


You're right it's an issue with the networking. It effects all X11 connections to Hyper-V apparently. A solution is to use something other than TCP/IP for the X11 connection.

The developer of the Windows X11 server x410 explained how to fix it for Hyper-V VMs by using Virtual Sockets here.

Unfortunately, he also explains on at the end of this more extensive article he wasn't able to get this working on WSL2. He's going to wait for WSL2 to mature until it has better inter-OS communication via Unix domain sockets.

  • 1
    is there a way to re-attach?
    – Nishant
    Feb 10, 2020 at 14:07
  • 4
    Not currently, since when programs lose their connection to X they terminate. That's just the normal behavior. There's some tools out there that keep X11 sessions persistent between connections by having a proxy of sorts in the middle to keep the programs connected to something when the TCP connection drops. I didn't investigate any of those solutions though. They were all too complex given a solution coming down the pipe. Feb 23, 2020 at 7:52
  • 3
    VcXsrv is subject to the same problem by all accounts I've seen Feb 24, 2020 at 19:58
  • 1
    This solution works now for WSL2 with X410 version 3.1.0 Jul 5, 2022 at 14:10
  • 1
    This is a link only answer. If those links go bad the answer will be close to useless. Please, for the sake of everyone else with this problem, edit the answer to include the actual answer here. Jun 22 at 14:08

You can use Xpra or X2Go as a workaround (for me X2Go works better).


  1. Install Xpra on your Linux distribution (apt install xpra on Ubuntu).
  2. Install Xpra on Windows (the installer is under Xpra client Download)
  3. Launch xpra in Linux using xpra start --bind-tcp= :10000
  4. Launch Xpra.exe in Windows and connect to Port 10000.

The client will reconnect automatically after a sleep/standby. Even when you lose the connection (maybe when logging into a VPN) you can always reconnect manually.


  1. Install X2Go on your Linux distribution (apt install x2goserver on Ubuntu).
  2. Install X2Go client on Windows (the installer is under X2Go client Download)
  3. Fix and start sshd on Linux:
    sudo apt-get remove --purge openssh-server
    sudo apt-get install openssh-server
    sudo service ssh --full-restart
    You will also have to start sshd on every WSL restart with sudo service ssh start.
  4. Launch the client on Windows, connect using "Session type: Published Applications"

PS: I am currently writing a small blog post: Development Environment in WSL2


There is a perfectly good solution to this: https://github.com/nbdd0121/wsld.

WSL Daemon - Stable X11 connection and time synchronisation for WSL2

It does exactly what one of the other solutions elude to: uses Unix domain sockets. I've been using it for many months without a problem.

  • This is a link only answer. If the link goes bad this answer is worthless. Edit your post to include all of the answer steps and details here. Jun 22 at 14:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .