Skip to content
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

Can't run inside a tmux session? #2

Closed
schmitmd opened this issue Sep 25, 2020 · 5 comments
Closed

Can't run inside a tmux session? #2

schmitmd opened this issue Sep 25, 2020 · 5 comments

Comments

@schmitmd
Copy link

schmitmd commented Sep 25, 2020

Hi there.

Any idea why I can't run this inside a tmux session? I get:

myuser@LAPTOP ~ % sudo ./wsl-vpnkit.sh
successfully created TAP device eth1
starting in connect mode with path=/var/run/wsl-vpnkit.sock and tap=eth1
Failure reading from socket: closing: Connection reset by peer
Failed to read hello from client
Failed to negotiate vmnet connection
Failure reading from socket: closing: Connection reset by peer
Failed to read hello from client
Failed to negotiate vmnet connection

But in a regular terminal:

myuser@LAPTOP ~ % sudo ./wsl-vpnkit.sh
vpnkit.exe: [INFO] Setting handler to ignore all SIGPIPE signals
vpnkit.exe: [INFO] Version is 218f01482560cba2fa863f9ad872ad51d1e717fc
vpnkit.exe: [INFO] System SOMAXCONN is 2147483647
vpnkit.exe: [INFO] Will use a listen backlog of 32
vpnkit.exe: [INFO] No periodic Gc.compact enabled
vpnkit.exe: [WARNING] There is no database: using hardcoded network configuration values
vpnkit.exe: [INFO] DNS server configured with no builtin DNS names; everything will be forwarded
vpnkit.exe: [INFO] 2 upstream DNS servers are configured
vpnkit.exe: [INFO] Disabling transparent HTTP redirection
vpnkit.exe: [INFO] Updating resolvers to use host resolver
vpnkit.exe: [INFO] Secure random number generator is available
vpnkit.exe: [INFO] Add(3): DNS configuration changed to: use host resolver
vpnkit.exe: [INFO] DNS server configured with builtin DNS names [ gateway.internal -> 192.168.67.1, host.internal -> 192.168.67.2, vm.internal -> 192.168.67.3 ]
vpnkit.exe: [INFO] Will use the host's DNS resolver
vpnkit.exe: [INFO] New Gateway forward configuration: []
vpnkit.exe: [INFO] Configuration server_macaddr = f6:16:36:bc:8a:c6; max_connection = None; dns_path = None; dns = ; resolver = Host; domain = None; allowed_bind_addresses = 0.0.0.0; gateway_ip = 192.168.67.1; host_ip = 192.168.67.2; lowest_ip = 192.168.67.3; highest_ip = 192.168.67.14; dhcp_json_path = None; dhcp_configuration = None; mtu = 1500; http_intercept = None; http_intercept_path = None; port_max_idle_time = 300; host_names = host.internal; gateway_names = gateway.internal; vm_names = vm.internal; udpv4_forwards = []; tcpv4_forwards = []; gateway_forwards_path = None; pcap_snaplen = 128
vpnkit.exe: [ERROR] Failed to parse address '' from hosts file
vpnkit.exe: [INFO] C:\Windows\System32\drivers\etc\hosts file has bindings for vmware-localhost vmware-localhost host.docker.internal gateway.docker.internal kubernetes.docker.internal
successfully created TAP device eth1
starting in connect mode with path=/var/run/wsl-vpnkit.sock and tap=eth1
vpnkit.exe: [INFO] Vmnet.Server.negotiate: received { magic = VMN3T; version = 22; commit =                                          }
Server reports version 22, commit 0123456789012345678901234567890123456789
vpnkit.exe: [INFO] Generated UUID on behalf of client: 0656efd6-6cfe-88af-a0f2-8a98a931cc47
vpnkit.exe: [INFO] Vmnet.Server.negotiate: received Ethernet 0656efd6-8cfe-49af-a0f2-8a98a931cc47
vpnkit.exe: [INFO] Vmnet.Server.negotiate: sending { mtu = 1500; max_packet_size = 1550; client_macaddr = 02:5a:00:00:00:01 }
vpnkit.exe: [INFO] Vmnet.Server.listen: rebinding the primary listen callback
vpnkit.exe: [INFO] Vmnet.Server.listen: starting event loop
vpnkit.exe: [INFO] Connected Ethernet interface f6:16:36:8a:f9:c6
VMNET VIF has MAC 02:5a:00:00:00:01
vpnkit.exe: [INFO] Client mac: 02:5a:00:00:00:01 server mac: f6:16:36:8a:f9:c6
vpnkit.exe: [INFO] TCP/IP ready
vpnkit.exe: [INFO] TCP/IP stack connected

And finally: Thank you SO much for this! Very creative and useful.

@sakai135
Copy link
Owner

I haven't found a solution, but the issue seems to be because calling a Windows process doesn't work using sudo inside tmux. The line below will work outside of tmux but doesn't seem to do anything inside tmux.

sudo /mnt/c/WINDOWS/system32/notepad.exe

@liath
Copy link

liath commented Sep 30, 2020

You need to preserve envvars with sudo -E . or set WSL_INTEROP.

@liath
Copy link

liath commented Sep 30, 2020

Idk why this is only a concern under tmux fwiw, there's probablly some magic happening somewhere. /shrug

@schmitmd
Copy link
Author

It's just much easier to start up a tmux session and detach from it so that the window doesn't accidentally get closed or something. The sudo -E wsl-vpnkit.sh that you mentioned works like a charm. Thank you!!
@sakai135 , do you think you could tack this info into the README?

@sakai135
Copy link
Owner

sakai135 commented Oct 1, 2020

@liath thanks for the info!

@schmitmd added the info to the readme

@sakai135 sakai135 closed this as completed Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants