wikiped/Wsl-IpHandler

Changing /etc/wsl.conf file breaks WSL configuration

antontkv opened this issue · 2 comments

Hello. Thanks for this utility, it's really helpful.

I noticed a bug, that if you put any configuration in /etc/wsl.conf after this lines:

static_ip = 192.168.50.2
wsl_host = ubuntu
windows_host = windows

It won't be applied. So you need to make sure to put any other configuration above this lines. Maybe you could consider using any other file for configuration?

Thank you for spotting and reporting this bug.

Just to clarify:

When you say:

It won't be applied

Do you mean that WSL itself ignores the settings you put there?

Would it be possible to illustrate the issue with an example of wsl.conf to reproduce the problem?

Would it be possible to illustrate the issue with an example of wsl.conf to reproduce the problem?

Yes, sure. For example this config creates file /test on WSL boot.

[boot]
command="touch /test"

[network]
static_ip = 192.168.50.2
wsl_host = ubuntu
windows_host = windows

And this one doesn't:

[network]
static_ip = 192.168.50.2
wsl_host = ubuntu
windows_host = windows

[boot]
command="touch /test"

If you delete or add some lines to the /etc/hosts file and use this config:

[network]
static_ip = 192.168.50.2
wsl_host = ubuntu
windows_host = windows
generateHosts = false

When you reboot WSL your changes to the /etc/hosts will be lost, because it's will be automatically generated. But this config will work fine:

[network]
generateHosts = false
static_ip = 192.168.50.2
wsl_host = ubuntu
windows_host = windows