WSL: DNS broken - /mnt/wsl is empty - resolv.conf missing

NOTE: This might be a reopen of #11036

Windows Version

Microsoft Windows [Version 10.0.22631.3880]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.153.1-microsoft-standard-WSL2

Distro Version

Ubuntu 22.04 LTS

Other Software

Docker is installed (WSL-based backend)

Repro Steps

I don’t know

Expected Behavior

accessing the internet being possible inside wsl

Actual Behavior

Every hostname- / url-based network request fails with Temporary failure in name resolution. The internet guided me towards the /etc/resolv.conf file. This file, however, is just a symlink to /mnt/wsl/resolv.conf which, from what I have read, should be automatically generated every time WSL boots. However, the /mnt/wsl directory is completely empty. When I create a file inside /mnt/wsl, it is deleted after a WSL reboot.

And obviously, with /etc/wsl/resolv.conf not existing, my DNS cannot resolve anything.

WSL used to work previously, I do not know when exactly it stopped working.

Diagnostic Logs

/etc/wsl.conf:


[boot]
systemd=true

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 21 (1 by maintainers)

Most upvoted comments

Hi @oKazuhiro

Can you check wether /mnt/wsl/resolv.conf exists in your WSL-Distro? grafik

The symbolic link does exist at /etc/resolv.conf, but the file it links to in /mnt/wsl/resolv.conf is missing.