microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.29k stars 814 forks source link

No internet connection under WSL2, but works fine under WSL1 #10349

Open 0xBeshoy opened 1 year ago

0xBeshoy commented 1 year ago

Windows Version

Microsoft Windows [Version 10.0.19045.3208]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.90.1

Distro Version

Ubuntu

Other Software

No response

Repro Steps

Installed multiple versions of Ubuntu (18, 20, 22) from different sources (Windows store, wsl cli, downloaded directly from windows wsl docs page)

Expected Behavior

Working internet connection under both versions of the distro installations, but it only works while using WSL1 but no way to make it work again under WSL2

Actual Behavior

I was only using WSL2 for all my Linux usage, and suddenly out of nowhere, WSL2 stopped connecting to the internet. I used every possible solution out there to make it work again:

I've defaulted for the moment to WSL1, until I can fix this. Otherwise I guess I'll do a fresh Windows installation.

Diagnostic Logs

I ran the collect-wsl-logs.ps1 script and when asked to reproduce the issue I ran ping bing.com on the WSL machine that doesn't connect to the internet. I uploaded the log files as is without touching them. https://github.com/0xBeshoy/wsl/blob/main/WslLogs-2023-08-09_15-58-30.zip

theunwisewolf commented 1 year ago

I am also having the same issue. Interesting thing is that Docker Desktop (whatever custom distro it uses) works fine with wsl2. But the Ubuntu distro has no internet on wsl2 (wsl1 is fine)

ghost commented 1 year ago

Do you know if this occurred as a result of a specific windows update?

/logs

microsoft-github-policy-service[bot] commented 1 year ago

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

0xBeshoy commented 1 year ago

@pmartincic which files from the logs generated should I upload to the issue, it generated a lot of files, and I'm concerned about personal info being leaked. Thanks for your help and time :) Edit: Regarding the Windows update, I don't think so, actually, I got an update after this happened and thought this update might fix the problem, but it didn't.

ghost commented 1 year ago

Well, we would like all the logs? It'll contain arguments passed to wsl.exe, for example. More specifically the etl? If you desire, you may parse most of that file using WPA or tracefmt. If you choose not to share, that is your choice? But that also means we can't do much.

You can also email it to our PM: Craig.Loewen@microsoft.com if you prefer that route.

0xBeshoy commented 1 year ago

@pmartincic I've updated the issue with the logs needed, thanks for your time and patience ✌

thes01 commented 1 year ago

Hello, similar thing happened to me recently. Internet connection in WSL2 stopped working when the laptop is connected to my mobile hotspot. When connected to a router, everything works ok. WSL1 works for both mobile hotspot and router.

0xBeshoy commented 1 year ago

Hello, similar thing happened to me recently. Internet connection in WSL2 stopped working when the laptop is connected to my mobile hotspot. When connected to a router, everything works ok. WSL1 works for both mobile hotspot and router.

@thes01 did you find a way to fix it?

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically closed since it has not had any author activity for the past 7 days. If you're still experiencing this issue please re-open it.

Thank you!

0xBeshoy commented 1 year ago

Why close the issue? I'm still waiting for @pmartincic reply

ghost commented 1 year ago

That's an error on our part, reopening

0xBeshoy commented 1 year ago

That's an error on our part, reopening

Thank you, appreciate your patience and time ✌️

str0mback commented 1 year ago

Disable "Windows Hypervisor Platform" - solved it for me. This is what features I have enabled:

image

0xBeshoy commented 1 year ago

Disable "Windows Hypervisor Platform" - solved it for me. This is what features I have enabled:

image

Tried this solution today, didn't work for me. Thanks anyway ✌️

str0mback commented 1 year ago

Disable "Windows Hypervisor Platform" - solved it for me. This is what features I have enabled: image

Tried this solution today, didn't work for me. Thanks anyway ✌️

How did you install WSL? Also, make sure you've got these disabled (I'm only using Hyper-V for Guarded Host, not for any actual VM's): image

spufidoo commented 8 months ago

I've been suffering with this as well. I've read the issue with interest, tried out a few things, but to no avail. I'd really like this to be solved. Is there anything I could try?

CutupAngel commented 1 month ago

Here is the solution. https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723