Featured image of post 在 WSL 中出现“Temporary failure resolving~”时的解决方法

在 WSL 中出现“Temporary failure resolving~”时的解决方法

在 WSL 中出现“Temporary failure resolving~”时的解决方法

1
2
3
4
kenji@MyComputer:~$ sudo apt update
[sudo] password for kenji:
Err:1 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'

当在 WSL 中显示上述错误时,可能是 DNS 服务器的设置不正确。 在我的环境中,通过以下步骤解决了该问题。

  1. 启动 WSL。
  2. 运行 sudo nano /etc/resolv.conf
  3. nameserver 的行更改如下:
1
nameserver 8.8.8.8
  1. Ctrl + S 保存,然后按 Ctrl + X 退出。
  2. 运行 sudo apt update
  3. 如果没有显示错误,说明问题已解决。

如果上述步骤未能解决问题

似乎也有上述步骤无法解决问题的情况。请参考以下文章。

comments powered by Disqus
使用 Hugo 构建
主题 StackJimmy 设计