WSL: WSL2-Ubunutu networking is completely broken for me!
EDIT: This is resolved (NEVERMIND NOT RESOLVED!)
EDIT2: Removing systemd does solve the networking problem, but it turns out my ddev setup requires docker-ce which will not run if systemd is disabled. So disabling systemd is not an option to fix this for me.
EDIT3: OK now solved but cant explain what happened or why the steps that resulted in fixing the issue resolved it. See comments for those steps if you’re here with the same issue.
I first posted this over in the discussions tab because I’m not sure this is a bug, but I really need help and I’m not sure if anyone able to help me will actually see that post and respond to it before I’m forced to just go nuclear with my PC and reinstall windows from scratch. I absolutely do not want to do that. This PC is only 6 months old and I have not had ANY issues with WSL (which I use for my development environments for work) at all until today.
Here is my post from the discussions (please help!):
For the record I have already tried and verified no effect the following:
- I have already tried uncompressing the %TEMP% folder and the application components directory.
- This is NOT a DNS problem or related to resolve.conf
- Also note that the issue persists even with windows firewall completely disabled.
- I only run windows defender for A/V.
I lost my entire work day to this so I am really not happy.
At the beginning of the day I had some weird resource problems caused by Adobe Acrobat so I killed it. I have no clue if this is related or not but it’s were my issues began. Shortly after that I tried to open my IDE which has all of my project files living in the WSL system. The IDE hung and would not launch. I finally figured out something was wrong with WSL. The Explorer listing for “Linux” was in the tree, but under that, where the “Ubuntu” folder that contains the filesystem is normally there. In this case there was nothing listed.
At this point no “wsl.exe” commands would work (just infinite hang).
Rebooting did not solve it.
I eventually regained my WSL system after doing a chkdsk /r then an sfc /scannow and finally a dism /online /cleanup-image /restorehealth
After the last command is when things started working again.
However that was apparently only half the battle.
While I can open a shell prompt and access my files, the shell and software running in the ubuntu wsl system cannot access the local network or the internet. The odd thing is that the internet works inside WSL for a brief moment after opening a ubuntu/wsl shell and running a ping against my local network’s default gateway address immediately after signing in after a reboot.
Strangely it works, fails, works again then fails permanently. Here is a log of pings I was able to grab immediately after my last reboot:
Thu Mar 20 16:38:52 CDT 2025 PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
Thu Mar 20 16:38:52 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=1 ttl=63 time=143 ms
Thu Mar 20 16:38:53 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=2 ttl=63 time=140 ms
Thu Mar 20 16:38:54 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=3 ttl=63 time=5.79 ms
Thu Mar 20 16:38:55 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=4 ttl=63 time=178 ms
Thu Mar 20 16:38:56 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=5 ttl=63 time=178 ms
Thu Mar 20 16:38:57 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=6 ttl=63 time=2.23 ms
Thu Mar 20 16:38:58 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=7 ttl=63 time=2.22 ms
Thu Mar 20 16:38:59 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=8 ttl=63 time=2.30 ms
--- STOPS GETTING REPLIES HERE FOR APPROX 32s, THEN RESUMES ---
Thu Mar 20 16:39:31 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=39 ttl=63 time=1.79 ms
Thu Mar 20 16:39:32 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=40 ttl=63 time=2.36 ms
Thu Mar 20 16:39:33 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=41 ttl=63 time=2.76 ms
Thu Mar 20 16:39:34 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=42 ttl=63 time=2.13 ms
Thu Mar 20 16:39:35 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=43 ttl=63 time=2.28 ms
Thu Mar 20 16:39:36 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=44 ttl=63 time=2.19 ms
Thu Mar 20 16:39:37 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=45 ttl=63 time=2.09 ms
Thu Mar 20 16:39:38 CDT 2025 64 bytes from 192.168.1.254: icmp_seq=46 ttl=63 time=2.12 ms
--- NO MORE REPLIES RECEIVED AFTER THIS ---
You can see that pinging was working when I ran the command. It received 8 replies between 4:38:52 PM and 4:38:59 PM. It then lost connection and no replies were returned for ~32 seconds when the replies started coming back again at 4:39:31 PM. This lasted for another 8 responses before dying permanently at 4:39.38 PM
I did find a bunch of Hyper-V-VmSwitch event viewer logs around this time, but I checked my other machine with a working WSL installation and similar looking logs appear in there so while I originally thought they were related I feel it might not be now.
I’m so cooked right now. I cant do my job at all with this like this. I cant find any resources that explain how to just reinstall the networking stuff for this so that it works again. I have had this setup for over 6 months and have not had one single problem this whole time. I hope someone has some clue as to what I can do to fix this…
EDIT details:
SYSTEMD is related to the issue somehow
The problem apparently was that in my /etc/wsl.conf file the following entry was present (I now know this was added during the ddev / docker-ce installation because docker-ce requires systemd:
[boot]
systemd=true
Removing systemd, then doing (from the host os):
> wsl --shutdown
> hnsdiag reset all
All networking issues were resolved. However I found later that this then breaks docker-ce so its not a valid fix.
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 16
Final update from me on this for now… Apparently this is all working for me and I’m supposed to just believe the last few work days were just some sort of fever dream that didn’t happen?
My WSL2 system now has working networking with
systemd=truein mywsl.conffile and mydocker-ceinstallation is working now too. I even rebooted my whole system and everything stayed working. Fingers crossed I’m done dealing with this.Here is the sequence of events that brought me here:
Booted up from hibratrion today, tried
git pullone of my projects from my WSL2 shell and the command failed due to networking. I checked mywsl.conffile and the systemd=true had returned (I did not realize when I ran a script on Friday to reinstall my docker-ce setup, it actually adds that setting as it’s required.Frustrated, I removed the command, then did the aforementioned wsl --shutdown / hnsdiag reset all commands.
This fixed my networking, but then discovered it broke my docker-ce again as
ddev startwould not function.At this point, I decided that I needed to just reinstall ddev / docker-ce from scratch so I went to the ddev site and ran the installer script they say to run (from elevated powershell):
This command then failed at some point due to docker-ce not running (socket missing in /var/run/docker).
Realizing now that I needed systemd for this, I added that
[boot]section withsystemd=trueback into mywsl.conffile and then closed all wsl shell windows, and did awsl --shutdownfrom my powershell. I did not run the hnsdiag command this time.I then ran the above command to install ddev again, and it worked.
I opened a new WSL2 shell and was able, to my surprise,
ping google.comsuccessfully while having systemd on and ddev working.To ensure this wasn’t a random “glitch” allowing it to work. I shut everything down and restarted.
I opened a Ubuntu shell and was immediately able to ping (and am still getting replies as I type this). I am also able to
ddev startwithout issue now too.I have no idea what the hell has been going on. I’m basically back to the how I started but the only difference is that now it works where as the past few days it did not. I would love to know what the hell caused this / what was happening so I can avoid that scenario in the future. The rage that was felt over these past few days cannot be good for my health…
Good luck to anyone else running into this right now. I hope this helps you in some way.
@RickKukiela as admin you could try running
hnsdiag reset allto reset your WSL endpoint(s). Usehnsdiag --helpfor all options. Whatresetdose is deleting all instances ofEndpointsandNetworksand upon WSL restart new ones will setup. There is alsoHostNetworkingServicepowershell module with several cmdles to get/remove WSL networking options. Run(get-module -Name hostnetworkingservice).exportedcommandsto see all.Also, what WSL networking mode are you using?