WSL: [WSL2] Can't update Ubuntu, git clone, apt install, but ping works (Windows 1909)
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.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 22
- Comments: 39 (1 by maintainers)
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
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.
Update: downgrading to WSL 1 seems to be the best option for now, while the WSL 2 bugs are ironed out?
wsl --list --verbosewsl --set-version [distro name] 1Having the exact same problem.
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.
i had same issue and resolve with disabling my anti virous application( symantec endpoint )
Had the same problem with eset security enabled. Firewall prevented access.
changed wifi from public to private, then reboot windows fixed it for me windows10 home 20H2 19042.985 ubuntu 20.04
I did a downgrade installed stuff I needed upgraded back. But yeah WSL 2 seems to be broken for now.
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 eth0sudo dhclient eth0This is where i found it: https://stackoverflow.com/a/62438375/10853017
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