Temporary failure in name resolution域名解析错误Failed to fetch...导致Ubuntu无法更新(WSL2)

sudo apt-get update
sudo apt-get upgrade
#错误

错误:Failed to fetch...   Temporary failure in name resolution

原因分析是:DNS服务器无法正确解析

解决方法:

sudo rm -f /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
reboot

来源:https://itectec.com/ubuntu/ubuntu-18-04-unable-to-connect-to-server-due-to-temporary-failure-in-name-resolution/

WSL2中重启办法

打开powershell输入 wsl.exe --shutdown

然后输入wsl.exe重启后尝试成功。

猜你喜欢

转载自blog.csdn.net/li4692625/article/details/112549612