Running Ubuntu on WSL and trying to push to github and download new python modules using pip and I get this error.
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f9d654fe0b8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)': /simple/tensorflow/I had a look at the resolv.conf file and maybe its corrupted as it just gives a few lines of @@@. Anyone got any ideas how to fix this?
When I run l
ls -al /etc/resolv.conf
-rw-r--r-- 1 root root 261 Nov 28 12:54 /etc/resolv.confUpdate:
I managed to fix the problem. Needed to edit the file and add a line like this:
nameserver 8.8.8.8 8 6 Answers
I have the same problem. It also seems to be realted to VPN. I found out, that it only fails the DNS lookup when I first connect the VPN before starting WSL-Ubuntu after System-Reboot. First starting WSL-Ubuntu and afterwards connecting the VPN seems to work.
2Inside WSL2, create or append file: /etc/wsl.conf
Put the following lines in the file in order to ensure the your DNS changes do not get blown away
sudo tee /etc/wsl.conf << EOF [network] generateResolvConf = false EOFIn a
cmdwindow (!!), runwsl --shutdownStart WSL2
Run the following inside WSL2
sudo rm -rf /etc/resolv.conf sudo tee /etc/resolv.conf << EOF search yourbase.domain.local nameserver 8.8.8.8 nameserver 1.1.1.1 EOF
I had the same error. Pinging IP addresses worked, but no DNS resolution. Outside of WSL everything was fine. The problem was caused by OpenVPN for me, when I disconnected from my workplace's VPN, the error was gone.
2For me it was a simple fix. From powershell:
wsl --shutdownAnd then restart wsl and it worked. Yes, I know this solution is too simple and might not be good to you if trying to avoid reset to WSL. But in case you look for something simple, maybe worth trying
When I ran ls -lah /etc/resolv.conf, I saw that it was a symlink to ../run/resolvconf/resolv.conf.
But then I noticed that ../run/resolvconf/resolv.conf didn't exist, and in fact, although the /run/ directory existed, /run/resolvconf/ did not.
So I created that directory and also created an empty file sudo vim /run/resolvconf/resolv.conf.
Then I edited that file to contain:
nameserver 1.1.1.1After saving that file, ping google.com worked!
(It seems like that file is required. I don't know how mine got removed.)
was helpful for me.
I've had this issue random on multiple machines, old / new / W10 / W11. In my case if I turn off the Windows Defender Firewall -> DNS resolution works fine from WSL. Turning it back on and logging packet drops shows the issue at the public network profile:
#Version: 1.5
#Software: Microsoft Windows Firewall
#Time Format: Local
#Fields: date time action protocol src-ip dst-ip src-port dst-port size tcpflags tcpsyn tcpack tcpwin icmptype icmpcode info path
2022-02-01 20:30:34 DROP UDP 172.30.230.159 172.30.224.1 29101 53 45 - - - - - - - RECEIVE
2022-02-01 20:30:35 DROP UDP 172.30.230.159 172.30.224.1 18103 53 45 - - - - - - - RECEIVEI fixed it by setting an inbound firewall rule for the WSL network adapter - run this in Powershell:New-NetFirewallRule -DisplayName "WSL allow in" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow