admin管理员组文章数量:1618714
今天在WSL进行操作的时候,发现从网络上下载东西无法成功,包括wget
、apt-get
等命令都无法正常使用,比如执行sudo apt-get update
的时候会提示
Err:1 http://security.ubuntu/ubuntu bionic-security InRelease
Temporary failure resolving 'security.ubuntu'
Err:2 http://archive.ubuntu/ubuntu bionic InRelease
Temporary failure resolving 'archive.ubuntu'
Err:3 http://archive.ubuntu/ubuntu bionic-updates InRelease
Temporary failure resolving 'archive.ubuntu'
Err:4 http://archive.ubuntu/ubuntu bionic-backports InRelease
Temporary failure resolving 'archive.ubuntu'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu/ubuntu/dists/bionic/InRelease Temporary failure resolving 'archive.ubuntu'
W: Failed to fetch http://archive.ubuntu/ubuntu/dists/bionic-updates/InRelease Temporary failure resolving 'archive.ubuntu'
W: Failed to fetch http://archive.ubuntu/ubuntu/dists/bionic-backports/InRelease Temporary failure resolving 'archive.ubuntu'
W: Failed to fetch http://security.ubuntu/ubuntu/dists/bionic-security/InRelease Temporary failure resolving 'security.ubuntu'
W: Some index files failed to download. They have been ignored, or old ones used instead.
经过查询和搜索(解决bug真的痛苦😫),发现通过一下几行命令可以解决
sudo rm /etc/resolv.conf
sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf'
sudo bash -c 'echo "[network]" > /etc/wsl.conf'
sudo bash -c 'echo "generateResolvConf = false" >> /etc/wsl.conf'
sudo chattr +i /etc/resolv.conf
接下来下载东西就都没有问题了。
参考资料: Github上的一个issue
本文标签: failureTemporaryWSLUbuntuarchive
版权声明:本文标题:WSL问题: Temporary failure resolving ‘archive.ubuntu.com‘ 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://m.elefans.com/dianzi/1728785237a1173240.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论