Question: I had problems with hostnames resolving in windows Linux-subsystem so I removed /etc/hosts and wrote new version of it. That solution solved my problem, but after every reboot system started overriding /etc/hosts by a some default version, so I need setup hosts again and again. 
Is it possible to setup linux subsystem so it copies original windows hosts file or at least doesn't delete already written file ?

Answer: 
I did not have the line saying: `To prevent automatic generation of this file, remove this line.`in my /etc/hosts.

What I ended up doing was creating an addHosts.sh script with the following content:

```
MYHOSTS="ip1\thostname1\nip2\thostname2"
grep hostname1 /etc/hosts >> /dev/null || echo $MYHOSTS | sudo tee -a /etc/hosts >> /dev/null

```

The grep prevents adding the entries multiple times if you open separate instances of your linux distro. 

Afterwards you have to add `sudo addHosts.sh` to your bashrc and (optionally) create an exception for sudo password prompt for this script in /etc/sudoers:

`user ALL = (root) NOPASSWD: /path/to/addHosts.sh`
Your issue is adressed here:
<https://github.com/Microsoft/BashOnWindows/issues/398>

To prevent WSL from automatically generating the /etc/hosts file on every bash startup, you need to remove the following comment line in /etc/hosts:

```
# This file was automatically generated by WSL. To prevent automatic generation of this file, remove this line.

```