-
Notifications
You must be signed in to change notification settings - Fork 822
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/hosts file was overwritten by WSL at some point #3043
Comments
The ability to disable automatic generation of the /etc/hosts file became available in build 17093 and is coming to stable builds of Windows in the next cumulative update which is due soon: |
@benhillis so, I assume that the answer for 2 other questions is 'no': there is no backup by WSL and user can't trigger file update manually? |
Unfortunately the old /etc/hosts file was not backed up. The generated hosts file will be re-created when a new instance is launched. |
@benhillis seems that all existing WSL console sessions must be closed before new session can get an updated hosts file. |
@ownmaster - Correct, that is what I mean by a new instance. |
Add the hosts as follows: Open the following file in Notepad admin mode: add your hosts this at the end of the file e.g.192.168.2.30 ubmaster |
The issue in question is not how to find a workaround, its why WSL thinks it should be responsible for a core linux feature and why it transparently erases changes in a way that is against virtually every use case for WSL I can think of.. You should be given a blank hosts file because this issue was self-inflicted. |
Additionally to the windows hosts file, Ubuntu adds some own entries at the end of /etc/hosts. What is the basis for these lines? I want to add |
I had a hosts file with different content inside WSL for quite a long period of time (a few months at least, if not a year) and today I saw that it's content has been overwritten by
System32\drivers\etc\hosts
.Now
/etc/hosts
starts with:I would like to understand:
Windows version: 10.0.16299.309
The text was updated successfully, but these errors were encountered: