WSL 2: "sudo apt-get update" gives "Temporary failure resolving ..." error

PMM 11 Reputation points
2022-03-29T01:45:14.467+00:00

Installed WSL 2 (Debian, but previously tried Ubuntu with same issues). Installation went smoothly, but when I tried the following:

wsl2-prompt> sudo apt-get update

I get the following output to the terminal:

Err:1 http://security.debian.org/debian-security bullseye-security InRelease
Temporary failure resolving 'security.debian.org'
Err:2 http://deb.debian.org/debian bullseye InRelease
Temporary failure resolving 'deb.debian.org'
Err:3 http://ftp.debian.org/debian bullseye-backports InRelease
Temporary failure resolving 'ftp.debian.org'
Err:4 http://deb.debian.org/debian bullseye-updates InRelease
Temporary failure resolving 'deb.debian.org'
Reading package lists... Done
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://deb.debian.org/debian/dists/bullseye-updates/InRelease Temporary failure resolving 'deb.debian.org'
W: Failed to fetch http://security.debian.org/debian-security/dists/bullseye-security/InRelease Temporary failure resolving 'security.debian.org'
W: Failed to fetch http://ftp.debian.org/debian/dists/bullseye-backports/InRelease Temporary failure resolving 'ftp.debian.org'
W: Some index files failed to download. They have been ignored, or old ones used instead.

I am aware that there are networking issues with WSL 2 and have spent 4 days trying to sort out my issues. Unfortunately, there are many "try this, try that" suggestions out there with no clear answer (and certainly no clear reason for why there is this problem to begin with). Many of the suggestions actually contradict each other, which is not helpful (e.g., "change /etc/wsl.conf to have 'generateResolvConf=false' versus just putting 'generateResolvConf' per the learn.microsoft.com troubleshooting guides)

I do have Cisco AnyConnect but the problem I am experiencing (see above) occurs independent of whether VPN is working or not, so the underlying issue does not seem to be related to the "Cisco AnyConnect" problem for which I have also seen suggestions posted.

For the record, I have successfully installed WSL1 and have full "apt-get upgrade" capability. The problem is inherent with WSL2.

I have tried a hundred different combinations of things, like changing the contents of /etc/resolv.conf, /etc/wsl.conf, ~/.wslconfig, etc as suggested by several resources including including https://learn.microsoft.com/en-us/windows/wsl/troubleshooting, https://gist.github.com/coltenkrauter/608cfe02319ce60facd76373249b8ca6, https://janovesk.com/wsl/2022/01/21/wsl2-and-vpn-routing.html

Summary: what do I need to do, step-by-step, to get "sudo apt-get update" to work without a "Temporary failure resolving ..." error in my WSL2/Debian installation?

Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,346 questions
{count} votes

6 answers

Sort by: Most helpful
  1. gia fitano 0 Reputation points
    2024-09-20T15:43:52.9833333+00:00

    How about we not use this until Microsoft fixes their sh*t. After messing with this for several weeks, I uninstalled WSL and use VMWare Workstation instead. It works without issues.

    Come on, Microsoft, don't put the onus to fix your stuff on your users. That is extremely unprofessional.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.