$ 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.
系统:Windows 10 PRO 19044.1415
WSL 2,Ubuntu 20.04
ping
到 google.com 也失败了:ping: google.com: Temporary failure in name resolution
已经完成了:
wsl.conf
其中包含以下几行:
[network]
generateResolvConf = false
resolv.conf
用几个重新创建nameserver
:
nameserver 8.8.8.8
nameserver 8.8.4.4
nameserver 1.1.1.1
尝试过:
- 添加
nameserver 8.8.8.8
到wsl.conf
。不起作用。 - 保持单行
nameserver
在内resolv.conf
- 关注这些步骤
New-NetFirewallRule -DisplayName "WSL" -Direction Inbound -InterfaceAlias "vEthernet (WSL)" -Action Allow
从这里
问题已从 StackOverflow 替换
答案1
答案2
我发现这与我的情况相关:
https://docs.microsoft.com/en-us/windows/wsl/troubleshooting#no-internet-access-in-wsl
我不得不关闭 Symantec Network Threat Protection
答案3
输入以下命令并运行。然后再次更新。
wget --no-check-certificate http.kali.org/kali/pool/main/k/kali-archive-keyring_2022.1_all.deb