Categories
Tutorials

WSL2 Network Issues and Win 10 Fast Start-Up

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:

Network issue cannot reach WSL2: ERR_CONNECTION_REFUSED
Cannot reach page error: ERR_CONNECTION_REFUSED

I fixed this my editing the Windows hosts file, however when trying to pull code changs down via git, I encountered this worrying error:

ssh: Could not resolve hostname github.com: Temporary failure in name resolution

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:

Open the System settings in the control panel.

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.

Power & Sleep > Additional Power Settings

Next, select the Choose what the power buttons do option on the left of the Power Options screen.

Choose what the power buttons do

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.

Disable fast start-up to fix WSL2 network issues
Disable Turn on fast start-up option.

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!

Leave a Reply

Your email address will not be published. Required fields are marked *