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

/etc/resolv.conf always automatically made, and ignores /etc/wsl.conf #5527

Closed
mangelozzi opened this issue Jul 2, 2020 · 4 comments
Closed

Comments

@mangelozzi
Copy link

In /etc/resolv.conf it says:

# 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

Environment

Microsoft Windows [Version 10.0.19041.329]
Ubuntu lsb_release -r
WSL 2

Steps to reproduce

  1. /etc/wsl.conf didnt exist for me, so create it and add the following text to it:
[network] 
generateResolvConf = false 
  1. Save and close.
  2. Close Terminal, and re-open it.
  3. Open /etc/wsl.conf and edit the auto generated nameserver which fails to resolve, change it to something like 8.8.8.8.
  4. Save and close
  5. Wait a short while, and soon /etc/wsl.conf has reverted soon back to something like 172.30.16.1 which cant resolve github.com or PPA's etc.

Expected behavior

Not to change the nameserver as per the instructions.

Actual behavior

Windows is changing the nameserver to something that doesnt work. The fix to the fix is not working.

@benhillis
Copy link
Member

I suspect your /etc/reslv.conf is a symlink into /run, which is tmpfs and re-created at boot.

@therealkenc
Copy link
Collaborator

Ref #4285 (the de-facto hangout).

@mangelozzi
Copy link
Author

I suspect your /etc/reslv.conf is a symlink into /run, which is tmpfs and re-created at boot.

Thanks for the reply, you are correct @benhillis
lrwxrwxrwx 1 root root 29 Jun 10 13:28 /etc/resolv.conf -> ../run/resolvconf/resolv.conf

I deleted the symlink, made a new /etc/resolv.conf file:
-rw-r--r-- 1 root root 197 Jul 3 14:06 /etc/resolv.conf
Restarted, and it was also automatically changed back to a none working nameserver.

@mangelozzi
Copy link
Author

The Fix: reading this post, I see a simple wsl --shutdown was not enough, so I just restarted the whole pc to be sure it was restarted, and since then resolv.conf is no longer overwritten.

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

3 participants