1. 程式人生 > 其它 >Temporary failure in name resolution域名解析錯誤Failed to fetch...導致Ubuntu無法更新(WSL2)

Temporary failure in name resolution域名解析錯誤Failed to fetch...導致Ubuntu無法更新(WSL2)

技術標籤:WSL系統Ubuntuubuntulinux

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重啟後嘗試成功。