microsoft / WSL

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

[WSL2] Can't update Ubuntu, git clone, apt install, but ping works (Windows 1909) #5971

Open TheoForay opened 4 years ago

TheoForay commented 4 years ago

Environment

Windows build number: 18363.1082
Your Distribution version: Ubuntu 20.04 and Ubuntu 18.04
Whether the issue is on WSL 2 and/or WSL 1: It happened after I upgraded to WSL 2 and works fine in WSL 1

Steps to reproduce

sudo apt update, or git clone XXX can't connect. sudo apt update :

Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.

I checked ipconfig on PowerShell, and my vEthernet adapter for WSL isn't disconnected, and I can confirm that, as ping 8.8.8.8 actually works.

therealkenc commented 4 years ago

Please collect WSL logs and post the backlink to the feedback item here. Also please identify any third-party networking software that has been installed on Windows.

TheoForay commented 4 years ago

I would really like to follow the procedure to give more intel but unfortunately I don't have the Feedback Hub on my computer. I don't find a way to install it. Perhaps it's because it's on my company's laptop. Is there another I can provide you what you need?

ttelfer commented 4 years ago

Having the exact same problem.

maxlieblich commented 4 years ago

Having the same problem. Things work fine when I reboot the computer, but after a while WSL 2 loses its connection to certain things (apt, mainly) while ping still works fine. Here's my feedback backlink: https://aka.ms/AA9tug5

zhangshengsheng commented 4 years ago

same problem

ad-on-is commented 4 years ago

For me, even ping stopped working

patrickhoebeke commented 4 years ago

I had exactly the same issue (Windows 10 version 1903 (build 18362.1139) + Ubuntu 18.04 though WSL2) . It turns out that my wifi was configured in Windows as "public" network. Switching to "private" fixed the problem. Hope this can help

shiv-sid commented 4 years ago

I had exactly the same issue (Windows 10 version 1903 (build 18362.1139) + Ubuntu 18.04 though WSL2) . It turns out that my wifi was configured in Windows as "public" network. Switching to "private" fixed the problem. Hope this can help Excellent @patrickhoebeke . This worked for me...!!

robpomeroy commented 4 years ago

Subscribing. Initially ping to Ubuntu mirrors worked, but apt update didn't (timeout). Then finally ping stopped working too (destination unreachable).

WSL rendered unusable. Pity. Back to Hyper-V VMs (with a custom NAT vSwitch to overcome spurious WiFi adapter issues). >sigh<

robpomeroy commented 4 years ago

Update: downgrading to WSL 1 seems to be the best option for now, while the WSL 2 bugs are ironed out? wsl --list --verbose

wsl --set-version [distro name] 1

Thadir commented 4 years ago

I did a downgrade installed stuff I needed upgraded back. But yeah WSL 2 seems to be broken for now.

trallnag commented 3 years ago

Same for me. For now I'm going back into my "normal" VM :/

mickael-h commented 3 years ago

Same problem for me. I had to downgrade back to WSL 1...

jacobbaek commented 3 years ago

Same problem for me. Is there any workaround except downgrading back to WSL 1?

ad-on-is commented 3 years ago

Guys, check your firewall-settings. For me, Bitdefender Firewall blocks WSL2 traffic.

jacobbaek commented 3 years ago

@ad-on-is Thanks, I checked the firewall that i used at the desktop, this caused from firewall liked you mentioned. I thought it is strange why ICMP is working despite other all traffics are not working. but when i disabled the firewall policy, it is working and also checked the deny log in firewall log. Thanks again.

osmanatam commented 3 years ago

i am living the same problem.... in wsl1 update is working , in wsl22 update problem.... any solution??????

trallnag commented 3 years ago

@osmanatam add two rules to your firewall that all through the network interface used by WSL2, it is worth a try.

https://github.com/microsoft/WSL/issues/4277#issuecomment-733021720

adam-grant-hendry commented 3 years ago

Same problem for me

jacobbaek commented 3 years ago

Guys, check to firewall. WSL1 and WSL2 have different network interfaces. WSL1's network interfaces is that shared with host network, on the other hands WSL2 network interfaces has only one network intetface that works as NAT. So WSL1 can access where the host can access. But WSL2 can not access where the host can access.

dan640 commented 3 years ago

This fixed the issue for me https://github.com/microsoft/WSL/issues/5867#issuecomment-688076090

EDIT: This just fixed it temporary. The issue is back. Apparently when the network configuration changes (VPN off and then on again) then WSL2 cannot find its way to the internet anymore.

hallownfs commented 3 years ago

sudo ifconfig eth0 mtu 1350 using this fixed the issue for me source : https://github.com/microsoft/WSL/issues/4253

lukee1234 commented 3 years ago

If you modified, moved or compressed the temp folder, look at #5437 for the solution

robpomeroy commented 3 years ago

sudo ifconfig eth0 mtu 1350 using this fixed the issue for me source : #4253

Me also. So WSL 2 causes packet fragmentation?

eldano1995 commented 3 years ago

Checkout my comment: maybe it helps: https://github.com/microsoft/WSL/issues/5061#issuecomment-756457106

exowanderer commented 3 years ago

Update: downgrading to WSL 1 seems to be the best option for now, while the WSL 2 bugs are ironed out? wsl --list --verbose

wsl --set-version [distro name] 1

I tried and tried and tried to configure my firewalls to let the WSL2 work it's magic. I followed several tutorials that all led to the same ~5 ways to config the firewalls.

In the end, I set WSL version back to 1; and it worked as though 'nothing was wrong'.

williamvm commented 3 years ago

changed wifi from public to private, then reboot windows fixed it for me windows10 home 20H2 19042.985 ubuntu 20.04

kbillore commented 3 years ago

Check what antivirus you are using. I was having McAfee and endpoint security enabled. If disconnect End Point security firewall connectivity will work straightaway (no reboot required).

https://kc.mcafee.com/corporate/index?page=content&id=KB91411

jdsdc commented 3 years ago

Had the same problem with eset security enabled. Firewall prevented access.

msaadegh commented 3 years ago

i had same issue and resolve with disabling my anti virous application( symantec endpoint )

Rist88 commented 3 years ago

I had exactly the same issue (Windows 10 version 1903 (build 18362.1139) + Ubuntu 18.04 though WSL2) . It turns out that my wifi was configured in Windows as "public" network. Switching to "private" fixed the problem. Hope this can help

That helped, thanks.

contstriver commented 3 years ago

i had same issue and resolve with disabling my anti virous application( symantec endpoint )

Yes, I also find that. windows security ->disable Firewall&network protection (symantec endpoint protection)

shaunr30 commented 3 years ago

Been dealing with troubleshooting this issue for days - literally a firewall issue. Using Avast, all you had to do was change your current network to a trusted network.

ckolluru commented 2 years ago

I had to do the following when working with symantec endpoint protection:

Open the app > Click on options next to network and host exploit mitigation > configure firewall rules > uncheck all options

After doing that, sudo apt-get update and sudo apt-get upgrade worked.

universalamateur commented 2 years ago

This article was helpful for me to resolve my issues: https://wheatevo.com/wsl-2-and-vpn/

Dimimo commented 2 years ago

In my case it was the VPN (NordVPN) preventing the connection. Temporarily putting it on hold solves the problem.

abdullah-bin-hasan commented 12 months ago

Doing these solved my problem: Open Hyper-V Manager as administrator

Select your pc, open Virtual Switch Manager

Select WSL

Set to external network

Select the network card the traffic runs through

Then login to wsl2 terminal and configure an IP address. E.g.

sudo ip addr flush dev eth0 sudo dhclient eth0

This is where i found it: https://stackoverflow.com/a/62438375/10853017