I recently encountered a network issue where my WSL2 (Windows Subsystem for Linux) distro was unable to retrieve DNS and connect to the internet without me changing /etc/resolv.conf
. Likewise, Windows was unable to connect to the WSL2 ports via localhost
.
To quickly workaround these issues, I set my nameserver to be 1.1.1.1
in /etc/resolv.conf
and updated my hosts
file in Windows to reflect the WSL2 IP. While this fixed the issue quickly, I had to change both files each time I opened WSL2… which sucked.
After a few hours of frustration and searching, I worked out what was breaking my WSL2: Fast Startup in Windows! Since I know I’ll forget this before it happens again, I thought it’d be best to document the fix here, so I can easily find it again. Hopefully it’ll help you fix your WSL2 network issues too!
WSL2 Network Issues
I first noticed the issue when trying to work on my local dev web server. I opened the browser and saw this:
I fixed this my editing the Windows hosts
file, however when trying to pull code changs down via git, I encountered this worrying error:
Again, I could work around this, but the fix was temporary.
Disabling Fast Startup
I eventually stumbled upon some advice to disable Fast Startup in Windows. It sounded familiar and I thought I had already disabled it before, but I figured I should check anyway. As it turns out, something had reenabled Fast Startup and it was the cause of the WSL2 network issues issues I was experiencing.
The option to disable it is buried under a few screens. Let’s walk through the process.
First, open up settings and go into the System settings:
Next, go into the Power & Sleep section and click Additional power settings under the Related Settings heading. Note, this option may be at the bottom of the screen, if your window isn’t wide enough to display it on the right.
Next, select the Choose what the power buttons do option on the left of the Power Options screen.
Finally, we’ve found the option! We just need to jump through the final hoop to stop it being greyed out and allow us to disable Fast Startup.
Select Change settings that are currently unavailable near the top. This will allow you to untick the Turn on fast start-up option under Shut-down settings.
Once you’ve disabled the option, close all the open windows and reboot your computer. WSL2 should start working with the network again!
Summary
This is a rather frustrating issue that can be a pain to debug and identify, but is fairly easy to fix when you know what you’re looking for. I hope you find this article helpful.
If you know of other resources that are helpful for debugging WSL2 network issues, please drop them below in the comments!
6 replies on “WSL2 Network Issues and Win 10 Fast Start-Up”
Thank You, you help-me with the second step
I don’t really know how you discovered this but it worked for me! Thanks
how the f**k you discovered this??
it worked!
thanks
This didnt work for me. The nameserver returns back to its default state, nameserver 17…, after I rebooted my computer.
Yep, changing the nameserver is only a temporary solution. Try disabling “Fast Startup” in Win10, as per the article. It fixes the issue permanently.
Worked like a charm. Saved me hours of troubleshooting. Thanks!