Featured image of post WSL 在 apt update 出現「Temporary failure resolving」錯誤時的解決方法

WSL 在 apt update 出現「Temporary failure resolving」錯誤時的解決方法

解說在 WSL 環境中執行「sudo apt update」時,出現「Temporary failure resolving」錯誤的解決方法。介紹變更 DNS 伺服器設定,讓套件管理員通訊恢復正常的步驟。

解決在 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 設計