Some index files failed to download. They have been ignored, or old ones used instead. When sudo apt update with WSL 2
$ sudo apt update
Err:1 focal InRelease Temporary failure resolving 'archive.ubuntu.com'
Err:2 focal-security InRelease Temporary failure resolving 'security.ubuntu.com'
Err:3 focal-updates InRelease Temporary failure resolving 'archive.ubuntu.com'
Err:4 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 Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.System: Windows 10 PRO 19044.1415
WSL 2, Ubuntu 20.04
ping to google.com also fails: ping: google.com: Temporary failure in name resolution
Already done:
wsl.confwith those lines inside of it:
[network]
generateResolvConf = false- re-created
resolv.confwith severalnameserver's:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1Tried:
- to add
nameserver 8.8.8.8intowsl.conf. Doesn't work. - keep single
nameserverline inside ofresolv.conf - followed those steps
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allowfrom here
Question replaced from StackOverflow
111 Answer
Finally found asnwer. It isn't even my fault...
This advice helped me, and sudo apt update finally worked. If u dont' have .wslconfig file, create it yourself.
Ended up with this inside of resolv.conf:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
nameserver 208.67.222.222 # OpenDNS address
nameserver 192.168.0.10 # ipv4 address of your windows machine. *1*1 - source