I'm running windows 10 with WSL2. I installed a distribution of Ubuntu 20.04.
When I do sudo apt update, it's working
Hit:1 focal InRelease
Get:2 focal-updates InRelease [114 kB]
Get:3 focal-security InRelease [114 kB]
Get:4 focal-backports InRelease [101 kB]
Fetched 328 kB in 17s (19.3 kB/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.Then I tried adding a repository for podman. In /etc/apt/sources.list
deb /But now when doing sudo apt update I got
Err:1 InRelease Temporary failure resolving 'download.opensuse.org'
Err:2 focal InRelease Temporary failure resolving 'archive.ubuntu.com'
Err:3 focal-security InRelease Temporary failure resolving 'security.ubuntu.com'
Get:4 focal-updates InRelease [114 kB]
Get:5 focal-backports InRelease [101 kB]
Fetched 214 kB in 34s (6269 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
All packages are up to date.
W: Failed to fetch Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch Temporary failure resolving 'download.opensuse.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.Yet a ping is working
PING download.opensuse.org (195.135.221.134) 56(84) bytes of data.
64 bytes from download.opensuse.org (195.135.221.134): icmp_seq=1 ttl=58 time=36.9 ms
64 bytes from download.opensuse.org (195.135.221.134): icmp_seq=2 ttl=58 time=35.9 msRemoving the repository line and it is working.
What would be the problem ?
Edit
I asked other coworkers to try the same and it's working for them. So I suppose it is not a proxy or dns problem on the network. The last 'guilty' :-) seems to be my laptop. But why ?
51 Answer
This worked for me: The solutions found online helped me fix the issue in my home network, but DNS resolution would still not work when using my laptop at the office. This is what seemed to work:
In WSL, set up two distributions, e.g. "Ubuntu" and "Debian"
- Set one to WSL version 1, and the other to WSL version 2
- wsl --set-version Ubuntu 1
- wsl --set-version Debian 2
- Copy the contents of /etc/resolv.conf in Ubuntu (WSL 1) to Debian (WSL 2)
Done Just converting wsl 2 back to wsl 1 provides the information needed to update /etc/resolv.conf. copy the content, convert back to wsl 2 and past the info in the /etc/resolv.conf.
It turned out that /etc/resolv.conf in WSL 1 had a special entry "search our-company-domain.de" (and some ipv4 and ipv6 addresses). One of the ips is the address of our central server. I guess I will also have to turn of the automatic generation of resolv.conf.
see:
0