This problem does not always occur. I think it does not occur if my laptop is on battery and goes to standby. It seems to regularly occur if its power connected and going to standby.
After wakeup I can't access my wsl aliases that I defined in .wsl2hosts anymore. Looking at the Windows hosts file they're gone and only the ubuntu.wsl address is included. Pinging this one from Windows seems to work.
I stopped the wslhost service and restarted it, but the hosts file didn't change. Then I closed wsl2 with wsl --shutdown and opened a new terminal to start it up again- this time Windows' hosts file contained all wsl aliases:
172.21.158.73 host.docker.internal # alias: Ubuntu; managed by wsl2-host
172.21.158.73 wsl.local.com # alias: Ubuntu; managed by wsl2-host
172.21.158.73 ubuntu.wsl # managed by wsl2-host
Maybe you could advice a quicker workaround to properly refresh the hosts file, other than closing wsl2 or rebooting Windows?
Wsl2host has proven to be an invaluable tool working with wsl2- thank you so much!
This problem does not always occur. I think it does not occur if my laptop is on battery and goes to standby. It seems to regularly occur if its power connected and going to standby.
After wakeup I can't access my wsl aliases that I defined in
.wsl2hosts
anymore. Looking at the Windows hosts file they're gone and only theubuntu.wsl
address is included. Pinging this one from Windows seems to work.I stopped the wslhost service and restarted it, but the hosts file didn't change. Then I closed wsl2 with
wsl --shutdown
and opened a new terminal to start it up again- this time Windows' hosts file contained all wsl aliases:Maybe you could advice a quicker workaround to properly refresh the hosts file, other than closing wsl2 or rebooting Windows?
Wsl2host has proven to be an invaluable tool working with wsl2- thank you so much!