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

DNS not working in WSL2, resolv.conf gets overwritten with symlink to ../run/resolvconf/resolv.conf #4844

Closed
xzn opened this issue Jan 23, 2020 · 4 comments

Comments

@xzn
Copy link

xzn commented Jan 23, 2020

DNS not working at all in WSL2 after upgrading,

After setting

[network]
generateResolvConf = false

in wsl.conf

resolv.conf keeps getting overwritten with symlink to ../run/resolvconf/resolv.conf

@xzn xzn changed the title DNS not working in WSL2, resolv.conf gets overwritten with symlink to ../run/resolvconf/resolv.conf DNS not working in WSL2, resolv.conf gets overwritten with symlink to ../run/resolvconf/resolv.conf Jan 23, 2020
@xzn
Copy link
Author

xzn commented Jan 23, 2020

Seems like a configuration issue on my end.

Now it's just #4285.

@xzn xzn closed this as completed Jan 23, 2020
@foobarbecue
Copy link

foobarbecue commented May 26, 2020

I'm having this same issue, after adding generateResolvConf = false to my /etc/wsl.conf .

@jgangso
Copy link

jgangso commented Jan 22, 2021

I faced the same issue that resolv.conf kept getting generated despite generateResolvConf = false:

I learned from #5420 (comment) the proper way to get rid of the generated symlinked file.
Basically what I was missing was the last command sudo chattr +i /etc/resolv.conf

My one-liner after which the resolv.conf started working as expected: (also after WSL2 shutdown)
sudo rm /etc/resolv.conf && sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' && sudo chattr +i /etc/resolv.conf

@piyush1104
Copy link

piyush1104 commented May 17, 2021

I faced the same issue that resolv.conf kept getting generated despite generateResolvConf = false:

I learned from #5420 (comment) the proper way to get rid of the generated symlinked file.
Basically what I was missing was the last command sudo chattr +i /etc/resolv.conf

My one-liner after which the resolv.conf started working as expected: (also after WSL2 shutdown)
sudo rm /etc/resolv.conf && sudo bash -c 'echo "nameserver 8.8.8.8" > /etc/resolv.conf' && sudo chattr +i /etc/resolv.conf

Thanks this worked for me. Weirdly earlier I was able to ping google.com and even update the system from official ubuntu mirrors. But for some reason, I was not able ping github.com or any other website. Now doing the above resolved it.

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

4 participants