Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating WSL appears to cause generateResolvConf to create only IPv6 nameserver entries, causing DNS resolution to fail. #12191

Closed
1 of 2 tasks
Msprg opened this issue Oct 22, 2024 · 3 comments

Comments

@Msprg
Copy link

Msprg commented Oct 22, 2024

Windows Version

Microsoft Windows 11 Pro for Workstations version 23H2 build 22631.4317

WSL Version

2.3.24.0 (with broken DNS, after running wsl --update) (the WSL with working DNS only shows help text for --version)

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

Linux version 4.4.0-22621-Microsoft ([email protected]) (gcc version 5.4.0 (GCC) ) #3672-Microsoft Fri Jan 01 08:00:00 PST 2016

Distro Version

Ubuntu 22.04

Other Software

Tailscale, zerotier, wireguard, other VPN software. It has never affected WSL in this way and haven't changed during upgrade -> restore from backup troubleshooting process.

Repro Steps

Here's what I did:

  1. fresh install windows
  2. install wsl1
  3. import Ubuntu that was previously exported from other Windows installation with wsl1 (with working DNS)
  4. At some point, when launching WSL, a prompt will appear:
Windows Subsystem for Linux is now available in the Microsoft Store!
You can upgrade by running 'wsl.exe --update' or by visiting https://aka.ms/wslstorepage
Installing WSL from the Microsoft Store will give you the latest WSL updates, faster.
For more information please visit https://aka.ms/wslstoreinfo
  1. Run wsl.exe --update as advised

  2. On the next launch of Ubuntu, the DNS is already not working.

  3. Restoring the entire windows installation to a backup taken before running 'wsl.exe --update' restores the DNS functionality back to normal.

Expected Behavior

I expect DNS entries in /etc/resolv.conf to correspond to DNS servers used by the Windows system.

Example of working config generated by WSL:

$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 10.2.0.2
nameserver 1.1.1.1
nameserver fec0:0:0:ffff::1

Actual Behavior

Broken DNS on multiple computers after upgrade—they all seem to share this same config generated by WSL:

$ cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2
nameserver fec0:0:0:ffff::3

Diagnostic Logs

No response

Copy link

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@Msprg
Copy link
Author

Msprg commented Oct 24, 2024

Apparently, a valid solution is to uninstall the WSL application as shown on the screenshot (correlate the uninstall command), keeping only the bottom two installed. Since this started to happen only recently, the WSL application downgrade to version lower than 2.3.24.0 could also fix this issue, however I have not explored this option yet. Also, this could be fixed in a future release after 2.3.24.0 as well.

Image

Other than this, while I haven't identified the exact cause of this issue. It seems that WSL always populates with 3 nameservers, the first ones from windows, and if there aren't any more defined in windows, it'll use those IPv6 addresses as shown above. Since the issue was that the entire file was populated only by the IPv6 DNS server addresses, I assume the WSL failed to source or identify which DNS server addresses are being used in windows. It treats it as if there was no DNS defined in windows whatsoever as well.

Anyway, I'm closing this since the WSL now appears to work fine without the app installed anyway, and I believe it's for wsl2 only, so this solution is good enough for my use case.

@yyuueexxiinngg
Copy link

yyuueexxiinngg commented Nov 4, 2024

I am currently experiencing the same issue with the WSL2 distro.

WSL version: 2.3.24.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.26100.2161

Ubuntu Distro

PS C:\WINDOWS\system32> wsl --list -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop-data    Stopped         2
  docker-desktop         Stopped         2
  kali-linux             Running         2

Generated resolv.conf

# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver fec0:0:0:ffff::1
nameserver fec0:0:0:ffff::2
nameserver fec0:0:0:ffff::3

WSL Config

[wsl2]
networkingMode=mirrored
dnsProxy=false
dnsTunneling=false

[experimental]
sparseVhd=true

NetworkingLogs
WslNetworkingLogs-2024-11-04_14-49-37.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants