WSL2-Ubunutu networking is completely broken for me!
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
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.
Contributor guide
Research direction
Start with the reported /etc/wsl.conf setting systemd=true and the host commands wsl --shutdown and hnsdiag reset all, then compare behavior with Docker CE enabled. Done means reproducing the networking failure, explaining why the reset steps affect it, and identifying a fix that preserves both WSL networking and Docker CE.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, linux
- Domain
- networking, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100