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 '19 at 15:27
  • @Biswapriyo, yes I have the same behavior on Xming. – andreas Aug 23 '19 at 16:56

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.

  • is there a way to re-attach? – Nishant Feb 10 '20 at 14:07
  • 3
    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. – stealthwang Feb 23 '20 at 7:52
  • Yeah @stealthwang, it seems like a trivial problem! I was about thinking about something like that as well ... but never though deep enough and I am not an expert! Maybe I will explore ... and am I also hoping VcXsrv solves this problem. – Nishant Feb 24 '20 at 16:02
  • 2
    VcXsrv is subject to the same problem by all accounts I've seen – stealthwang Feb 24 '20 at 19:58

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.