nbdd0121 / wsld

WSL Daemon - Stable X11 connection and time synchronisation for WSL2
Apache License 2.0
299 stars 26 forks source link

iptable No chain or Chain already exist #19

Open MasKogNavier opened 2 years ago

MasKogNavier commented 2 years ago

I tied below,

First ( at Windows10 Pro 64bit powershell by admin ) $ wsldhost.exe --daemon

Second ( at WSL2 Ubuntu 18.04 LTS) $ sudo ~/.cargo/bin/wsld

and got Error,

>Received time 2021-11-18T07:23:32.243436Z, clock off by 2ms 303us, adjust
iptables: No chain/target/match by that name.

After that, once Istopped the process with Ctrl + C and ran it again, I got the following.

>Received time 2021-11-18T07:41:20.395486Z, clock off by -1ms 964us, adjust
iptables: Chain already exists.

I think that isn't working well, right?

now my ~/.wsld.toml is below

# Leave out this section to disable X11 forwarding
[x11]
# X11 display number to listen *inside* WSL. The X server in Windows can specified as argument when running wsldhost.exe.
# Default to 0, can be omitted.
display = 0

# Leave out this section to disable time synchronisation
# If you need time synchronisation, you should either run wsld with root, or give it `cap_sys_time` capability using `sudo setcap cap_sys_time+eip <PATH to wsld>`.
[time]
# Interval between syncs
# Default to 10min, can be omitted
interval = "1hr"

# Leave out this section to disable TCP port forwarding
# This feature is experimental, feedbacks and suggestions welcome.
# This feature will WSL localhost to Windows localhost, so you can connect
# servers running in Windows in WSL. This feature requires interaction with
# iptables, so you need to either run wsld as root or allow wsld to use sudo.
[tcp_forward]
# iptables command to use. nftables seem not to work so you need to have
# the legacy one. If you are not using Debian it is likely you need to change it.

iptables_cmd = "sudo iptables"

# Ports to forward
ports = [ 6666 ]

# Leave out this section to disable SSH agent forwarding
[ssh_agent]
# Default to the path below, can be omitted if unchanged
# Set `SSH_AUTH_SOCK` to the path you specified.
#ssh_auth_sock = "/tmp/.wsld/ssh_auth_sock"

I can't fix this, so please help.

thank you.

nbdd0121 commented 2 years ago

I think this is working as intended. It will try to create a new chain regardless if it already exists or not (so will warn for the 2nd time) and will delete the rule regardless if it exists or not (so will warn for the 1st time).