Featured image of post How to Fix 'Temporary failure resolving' Error during apt update in WSL

How to Fix 'Temporary failure resolving' Error during apt update in WSL

Explains how to resolve the 'Temporary failure resolving' error that occurs when running 'sudo apt update' in a WSL environment. Introduces steps to change DNS server settings and properly restore communication for the package manager.

How to Fix “Temporary failure resolving…” Error in WSL

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'

When the above error appears in WSL, the DNS server settings might be incorrect. In my environment, I solved it with the following steps.

  1. Start WSL.
  2. Run sudo nano /etc/resolv.conf.
  3. Change the nameserver line as follows:
1
nameserver 8.8.8.8
  1. Save with Ctrl + S and exit with Ctrl + X.
  2. Run sudo apt update.
  3. If the error doesn’t appear, it’s solved.

If the above steps do not solve the issue

It seems there are cases where the above steps don’t resolve the issue. Please refer to the following article:

comments powered by Disqus