-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WSL2] Network connections are not restored after returning from Windows sleep mode #4992
Comments
I suppose this is also the reason why my WSL 2 Emacs over Xming X11 windows server have aborted with a traceback every time the computer returns from sleep. |
Similarly here, I suppose this is the cause of issue I experience with IntelliJ IDEA run from WSL 2, connecting to X Server on Windows. After coming back from sleep, IntelliJ window is gone and I have to start it again. Unfortunately IntelliJ IDEA doesn't (yet?) support WSL for Java development, that's why I run it straight from WSL (https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004275400-Developing-in-Windows-Subsystem-for-Linux and https://youtrack.jetbrains.com/issue/IDEA-223986) |
I'm getting this as well, but I use hibernate. I'm on Version 10.0.20197.1000 It's annoying, things I did to no avail: restarting via WSL --shutdown does nothing (same as restarting Lxssmanager). I have to reboot just to get connectivity back. Is there a way to initialize WSL's network stack since IP is |
Same on insider 20180.1000 (wsl kernel: 4.19.121), must reboot windows to get network back |
@thisguychris :
and @david50407 :
This seems to be a different issue than the one reported by @klesniewski :
which is what I am experiencing as well: I'm running an X server on Windows (VcXsrv) to use graphical Linux applications. This works perfectly, except that when Windows goes into standby and wakes up again, all X windows are gone. The Linux applications don't report any error (in the console) and appear to be running fine; it's only the X output that is gone (thus rendering the apps unuseable). I can simply kill the apps and restart them, and the X windows reappear fine. No reboot required, which is why I think there are separate issues here. |
@Spaak I was speaking at the context of the OP, which was @choung. If this is a new issue, should I file a new one? To add, I also use an X Server. But on my end, I really need to restart Windows. Not even signout works. I really need to restart the OS to connectivity back. cc @therealkenc |
same problem here. changing nameservers and using wsl --shutdown does not work OS: Windows Insider Dev Build - 20197.1000 |
My laptop used to work fine when closing and opening the lid. Now, it requires a reboot to reconnect. OS: Windows Insider Dev Build - Version 2004 - Build 20201.1000 |
Same problem. OS: Win10 pro insider preview: build 20201.re_prerelease.200822-1922
|
Did anyone manged to resolve this issue? |
I have the same issue, insider OS build 20206.1000 |
Similar issue here. It seems heavily linked with Hyper-V and stops obeying to any sort of logic once the issue starts to happen, reboot solves it. |
Also the same issue here. I use GUI apps through an X server and this issue is highly impacting. I do not require a reboot for things to work again, restarting the app suffices. (emacs through X410 X server). |
@Soberia this solution is only works once. I use this fix to get my network back and sleep again then the fix won't work anymore until I reboot... |
Still going on here as well. |
For me is gone after updating to Windows Insider 20236 |
OK so on build 20231 the |
I have the same issue - very annoying.
Only reboot makes WSL2 working again. |
I have the same issue.
I can't connect to my WSL2 ubuntu after returning from sleep mode. |
I used x11-over-vsock to solve the problem that the link between wsl2 and x410 is broken after the network change, but there is a problem with this library that the cpu will soar when the window is moved. |
+1 it's annoying, my emacs x11 window keep closing. |
Yes, im using wsl2. But now I have a problem with some connections. For example doing a git pull will fail 20% of the time. This thing happenz for all ssl connections |
Folks at WSL are working on native GUI - https://devblogs.microsoft.com/commandline/whats-new-in-the-windows-subsystem-for-linux-september-2020/#gui-apps and you can already check it out in Insiders build (not sure which version though). |
@troglotit not available yet in dev channel (21277), so I think that doesn't released into all insiders yet. |
How about the following method? The point is the R option of ssh.
|
@smzht that's an interesting idea. Not really liking the idea of sending x traffic through ssh though! It's a good idea for other use cases perhaps. |
@robmwalsh Ssh has an X option. It ’s similar to that. |
@smzht worth a try I suppose. My computer would certainly appreciate being able to go to sleep again, even if it does have to encrypt display traffic that's not even leaving my computer! Related: Is anybody from Microsoft actually working on this? |
This problem has gone away after I updated my Ubuntu by doing the following: I wrote a short article on how I solve this problem: |
Same problem here. Watching to see if this problem gets solved... |
Same here. Upgraded to WSL2 and now things are not coming back after sleep. |
I recently discovered https://github.com/nbdd0121/wsld which provides a workaround based on vsocks. So far it works really well for my X forwarding use case. |
https://github.com/nbdd0121/wsld does seem to work! I had to download pre-built binary for windows because custom built executable would just insta-crash. I am running x410/Void/i3 so I had to put the snippet from wsld into .profile and set up windows daemon in task scheduler. |
I also confirm that the |
Could not use wsld (os error 10013) in any way sadly. |
Hmm, today my computer with Windows 19042.928 came back from sleep with my X11 Emacs still running. Good! What changed? Or maybe I should wait a bit and see if it wasn't just a one-time thing... |
Same here on Version |
I'm experiencing this same issue with Windows 11 22000.282 and WSL2 Ubuntu 20.04. Network works fine on fresh boot, but after resuming from sleep or hibernate, WSL network connection is broken. |
Restarting LxssManager service on Windows terminated WSL distro |
Check in your So check what is in your If it contains:
Then WSL is not going to regenerate the The default for So you can explicitly set |
This has been resolved since few windows versions ago. |
This problem still exists on Windows 11 build 22621.1265 on a fairly fresh install. |
To prevent rebooting the whole system, you can try: |
Perhaps Microsoft can just fix their shit. This has been open since (early) 2020 ffs |
wsl --shutdown makes my system back, but this is not really a solution. All unsaved work are lost and very inconvenient. I really wish Microsoft can solve this issue. |
Not sure why, but after 6 months of constantly looking for a solution. This command fixed the issue (see: link):
|
Hi. Can you please collect networking logs by following the instructions below? |
Your Windows build number:
10.0.19582.1001
What you're doing and what's happening:
Originally found this problem while using X410 (X Server for Windows 10) with WSL2. I was able to confirm the same problem with much simpler program, netcat (https://en.wikipedia.org/wiki/Netcat).
The following problem only happens when TCP connections are made from WSL2 to Windows. When connections are made from Windows to WSL2, they are restored after sleep mode as expected.
netcat for Windows is available as an executable in Nmap package (https://nmap.org/download.html)
You don't need to install it. You just need to download its command-line ZIP file, unzip, go to that unzipped folder in PowerShell or Windows Command Prompt and execute the ncat.exe as shown above.
The above command puts ncat.exe into a server mode (-l) waiting for data at the port 9999 (-p).
If you have a WSL1, you can also use its 'nc' command. For example, if you have Debian in WSL1 and Ubuntu in WSL2, you can run "nc -l -p 9999 -v" in Debian and get the same result.
I used the "Ubuntu 18.04" installed from Microsoft Store.
2.1 Get the IP address for Windows host
2.2 Connect to the IP address found in Step 2.1
Assuming the IP address is 172.18.16.1:
2.3 You should get connection succeeded messages for both ncat.exe in Windows and nc in WSL2.
Type some text and press [ENTER] in Windows (ncat.exe) and WSL2 (nc). You should be able to confirm that the connection is active and working in both directions as expected.
Put your computer to Sleep (Windows Start -> Power -> Sleep)
After confirming that your computer is fully in sleep mode, wake it up.
ncat.exe in Windows shows that the connection is lost, but nc in WSL2 thinks the connection is still active.
What's wrong / what should be happening instead:
The network connection between WSL2 and Windows is completely restored after waking up from Windows sleep mode.
The same problem can be observed with Hyper-V virtual machines (TCP connections made from VM to Windows). However, I can work around it by using its VSOCK feature. But, as far as I can tell, there seems to be no plan for VSOCK or AF_UNIX in WSL2.
All in all, such problem can be fatal for developers who create server programs for Windows that can be used by Linux apps running in WSL2.
The text was updated successfully, but these errors were encountered: