Temporary failure in name resolution domain name resolution error Failed to fetch... resulting in Ubuntu unable to update (WSL2)

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

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

The reason analysis is: DNS server cannot resolve correctly

Solution:

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

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

Restart method in WSL2

Open powershell and enter wsl.exe --shutdown

Then enter wsl.exe to restart and try successfully.

Guess you like

Origin blog.csdn.net/li4692625/article/details/112549612