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

Any known issues with wsl-vpnkit and wsl 2.0.5? #246

Closed
blakeduffey opened this issue Oct 23, 2023 · 30 comments
Closed

Any known issues with wsl-vpnkit and wsl 2.0.5? #246

blakeduffey opened this issue Oct 23, 2023 · 30 comments

Comments

@blakeduffey
Copy link

blakeduffey commented Oct 23, 2023

Had a working Ubuntu 22.04 WSL instance:

Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy

Upgraded to 2.0.5 today via

wsl --update --pre-release

Now on:

WSL version: 2.0.5.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4485
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25880.1000-230602-1350.main
Windows version: 10.0.19045.3570

Now no network - the wsl-vpnkit instance keeps moving to a 'stopped' state

:(

@blakeduffey
Copy link
Author

I upgraded to 2.0.6 this morning - problem persists. I'm going to roll back to stable and verify.

@blakeduffey
Copy link
Author

Did an uninstall (back to whatever the base version of Windows) and upgraded to 1.2.5.0

Wsl-vpnproxy works now. Something definitely up with 2.0.5 and above

@blakeduffey
Copy link
Author

Looks like 2.0.7.0 has the same issue :(

@blakeduffey
Copy link
Author

Problem persists with 2.0.9.0 also

@bigruid
Copy link

bigruid commented Nov 14, 2023

https://github.com/sakai135/wsl-vpnkit/tree/main#wsl-gvproxyexe-is-not-executable-due-to-wsl-interop-settings-or-windows-permissions

I saw the error "wsl-gvproxy.exe is not executable due to WSL interop settings or Windows permissions" on my wsl, you can try modify GVPROXY_PATH to solve the problem.

@blakeduffey
Copy link
Author

blakeduffey commented Nov 14, 2023 via email

@theBNT
Copy link

theBNT commented Nov 14, 2023

@blakeduffey is this a duplicate of #240?

im in a similar situation, cant use the mirrored wsl networking mode but vpnkit doesnt work anymore as well :(

can you share how you switch between the WSL versions?

[edit] found your instructions here: microsoft/WSL#10681 (comment)

@blakeduffey
Copy link
Author

Basically duplicate - I have threads on this project and on WSL (suggested to cross post from someone on the WSL team)

Yeah - once I realize the newer version doesn't work (have test 2.0.5-2.0.9) - I uninstall via add/remove programs, then install the binary: https://github.com/microsoft/WSL/releases/download/2.0.4/wsl.2.0.4.0.x64.msi

Sometimes I have to re-register the wsl-vpnkit instance - but my primary ubuntu instance has been good. Always backup, of course. :)

@theBNT
Copy link

theBNT commented Nov 14, 2023

@blakeduffey so i fiddled some more and i was able to get my WSL 2.0.9.0 running with wsl-vpnkit 0.3.8

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3570
PS> wsl --unregister wsl-vpnkit
PS> wsl --import wsl-vpnkit --version 2 $env:USERPROFILE\wsl-vpnkit wsl-vpnkit_0.3.8.tar.gz
PS> wsl.exe -d wsl-vpnkit --cd /app DEBUG=1 wsl-vpnkit

i did have to nuke my distro (Debian) though, i think i screwed up the config from my tests with systemd and the DNS workaround.

PS> wsl --install -d Debian
theBNT@hostname:~$ wget https://google.de
2023-11-14 18:59:06 (1.10 MB/s) - ‘index.html’ saved [19249]

so maybe you can try with wsl-vpnkit 0.3.8, manual instantiation and a fresh distro?

@tmeader
Copy link

tmeader commented Nov 14, 2023

@blakeduffey so i fiddled some more and i was able to get my WSL 2.0.9.0 running with wsl-vpnkit 0.3.8

WSL version: 2.0.9.0
Kernel version: 5.15.133.1-1
WSLg version: 1.0.59
MSRDC version: 1.2.4677
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19045.3570
PS> wsl --unregister wsl-vpnkit
PS> wsl --import wsl-vpnkit --version 2 $env:USERPROFILE\wsl-vpnkit wsl-vpnkit_0.3.8.tar.gz
PS> wsl.exe -d wsl-vpnkit --cd /app DEBUG=1 wsl-vpnkit

i did have to nuke my distro (Debian) though, i think i screwed up the config from my tests with systemd and the DNS workaround.

PS> wsl --install -d Debian
theBNT@hostname:~$ wget https://google.de
2023-11-14 18:59:06 (1.10 MB/s) - ‘index.html’ saved [19249]

so maybe you can try with wsl-vpnkit 0.3.8, manual instantiation and a fresh distro?

Can confirm that 0.3.8 works running as a standalone script. 0.4.1 running via systemd doesn't function in WSL 2.0.9 (Windows 10 22H2)

@bigruid
Copy link

bigruid commented Nov 15, 2023

Thanks -I will look into it and get back to you I don't think this is related, however I can go back and forth between wsl 2.0.4 (works) and wsl 2.0.5+ (doesn't)

On Mon, Nov 13, 2023, 10:16 PM bigruid @.> wrote: https://github.com/sakai135/wsl-vpnkit/tree/main#wsl-gvproxyexe-is-not-executable-due-to-wsl-interop-settings-or-windows-permissions I saw the error "wsl-gvproxy.exe is not executable due to WSL interop settings or Windows permissions" on my wsl, you can try modify GVPROXY_PATH to solve the problem. — Reply to this email directly, view it on GitHub <#246 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH7HTW3QF3JZX4B3JLK35TYELO7RAVCNFSM6AAAAAA6MOEOYKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMBZGQ3TSMZRGM . You are receiving this because you authored the thread.Message ID: @.>

It works fine in 2.0.9 after modifying the configuration.

@blakeduffey
Copy link
Author

blakeduffey commented Nov 15, 2023

It works fine in 2.0.9 after modifying the configuration.

2.0.9 using wsl-vpnkit 0.4.1?

Would you mind detailing your exact procedure?

@typhoe
Copy link

typhoe commented Nov 15, 2023

Hi, after a wsl --update, I also have the error "wsl-gvproxy.exe is not executable due to WSL interop settings or Windows permissions" when I start wsl-vpnkit (latest 0.4.1) service with systemd (os ubuntu 22.04).

What's strange is that if I try to launch it with sudo systemctl start wsl-vpnkit, I indeed get the error but if I try launching it "manually" /mnt/c/Windows/system32/wsl.exe -d wsl-vpnkit --cd /app wsl-vpnkit, either from my user or root (via sudo), it works perfectly...

@nkmohi
Copy link

nkmohi commented Nov 15, 2023

@typhoe
I see the exact same behavior with WSL 2.0.9 and wsl-vpnkit 0.4.1:
"systemctl start" fails but running wsl-vpnkit manually works.

@blakeduffey
Copy link
Author

I'm going to reboot, clear all my existing instances, and try this approach

@mendhak
Copy link

mendhak commented Nov 15, 2023

Please let us know your results, that would be appreciated.

I tried it briefly in an existing distro and it seems to work, running the command manually.

Is there a way to get that to be invoked say in ~/.bashrc so it runs in the background? And I suppose it would also have to check if a process is already running if a new shell session starts.

@mendhak
Copy link

mendhak commented Nov 15, 2023

This workaround is rudimentary but seems to be good enough for now. Add this to ~/.bashrc

 if ! pgrep -f "wsl-vpnkit" > /dev/null; then nohup wsl.exe -d wsl-vpnkit --cd /app wsl-vpnkit start </dev/null >/dev/null 2>&1 &   else echo "wsl-vpnkit is already running"; fi

@stargriv
Copy link

stargriv commented Nov 16, 2023

I made it work on WSL 2.0.9 and wsl-vpnkit 0.4.1 by copying "wsl-gvproxy.exe" to a Windows directory and updating the service definition with the addition of GVPROXY_PATH to the ExecStart definition.

$grep ExecStart /etc/systemd/system/wsl-vpnkit.service
ExecStart=/mnt/c/Windows/system32/wsl.exe -d wsl-vpnkit --cd /app GVPROXY_PATH=/mnt/c/Users/my_user/wsl-vpnkit/wsl-gvproxy.exe wsl-vpnkit  

Not sure whether it influenced the fix I also added interop settings to /etc/wsl.conf:

[boot]
systemd=true

[network]
generateResolvConf=true

[interop]
enabled=true
appendWindowsPath=false

[boot]
command=service docker start

And enabled mirrored networking mode at .wslconfig:

cat /mnt/c/Users/my_user/.wslconfig
[experimental]
autoMemoryReclaim=dropcache
sparseVhd=true
networkingMode=mirrored
dnsTunneling=false
firewall=false

@blakeduffey
Copy link
Author

blakeduffey commented Nov 16, 2023

I'm going to some additional testing but I think this works for me also.

There is clearly something going on between when wsl-vpnkit is invoked as a systemd service (per the 0.4.1 system directions) vs when it is invoked otherwise. Some change was made in WSL 2.0.5 that impacts this?

The downside of invoking wsl-vpnkit in ~/.bashrc is it removes the ability to launch WSL Linux apps via wslg without starting the instance first. (eg. I have Brave Browser on my Windows Start menu)

I can click it and it works - even if the other 2 underlying wsl instances aren't running when I do. Clicking that shortcut launches Ubuntu instance, systemd service launches the wsl-vpnkit instance - and it's all seamless.

@ak11234
Copy link

ak11234 commented Nov 16, 2023

Having this issue too, will not run as a systemctl service (within Ubuntu) but will run as standalone when I invoke it from powershell, or even from within ubuntu. (both using the standard vanilla installation, invoking the wsl containerized installation)

Originally I got the "is not executable due to WSL interop settings or Windows permissions" error. So I unpacked the tar, placed the wsl-gvproxy.exe file into a folder, and provided it as an environment variable in the service definition file.

This did not work, now I get:
GVPROXY_PATH [/mnt/c/Users/[username]/apps/wsl-vpnkit-untarred/app/wsl-gvproxy.exe] does not exist
but I know that the file is accessible from this environment, I can run it directly in my ubuntu shell, so the path is correct, and interoperability is enabled for Ubuntu.

It seems like when the container is invoked from within a distro using systemd, it cannot seem to run the executable (either permissions or interop), but when invoked from within a distro using a normal shell, it can.

@stargriv
Copy link

stargriv commented Nov 17, 2023

Having this issue too, will not run as a systemctl service (within Ubuntu) but will run as standalone when I invoke it from powershell, or even from within ubuntu. (both using the standard vanilla installation, invoking the wsl containerized installation)

Originally I got the "is not executable due to WSL interop settings or Windows permissions" error. So I unpacked the tar, placed the wsl-gvproxy.exe file into a folder, and provided it as an environment variable in the service definition file.

This did not work, now I get: GVPROXY_PATH [/mnt/c/Users/[username]/apps/wsl-vpnkit-untarred/app/wsl-gvproxy.exe] does not exist but I know that the file is accessible from this environment, I can run it directly in my ubuntu shell, so the path is correct, and interoperability is enabled for Ubuntu.

It seems like when the container is invoked from within a distro using systemd, it cannot seem to run the executable (either permissions or interop), but when invoked from within a distro using a normal shell, it can.

Can you enable "automount" in wsl-vpnkit with:
wsl.exe -d wsl-vpnkit --cd /app sed -i -- "s/enabled=false/enabled=true/" /etc/wsl.conf

And it is better to shutdown WSL completely (wsl.exe --shutdown) and start it again.

@stargriv
Copy link

stargriv commented Nov 17, 2023

I'm going to some additional testing but I think this works for me also.

There is clearly something going on between when wsl-vpnkit is invoked as a systemd service (per the 0.4.1 system directions) vs when it is invoked otherwise. Some change was made in WSL 2.0.5 that impacts this?

The downside of invoking wsl-vpnkit in ~/.bashrc is it removes the ability to launch WSL Linux apps via wslg without starting the instance first. (eg. I have Brave Browser on my Windows Start menu)

I can click it and it works - even if the other 2 underlying wsl instances aren't running when I do. Clicking that shortcut launches Ubuntu instance, systemd service launches the wsl-vpnkit instance - and it's all seamless.

It works as a service in my case, but I had to modify the "ExecStart" and I also enabled automount on wsl-vpnkit (wsl.exe -d wsl-vpnkit --cd /app sed -i -- "s/enabled=false/enabled=true/" /etc/wsl.conf) to be able to run wsl-gvproxy.exe.

@ak11234
Copy link

ak11234 commented Nov 17, 2023

Can you enable "automount" in wsl-vpnkit with:
wsl.exe -d wsl-vpnkit --cd /app sed -i -- "s/enabled=false/enabled=true/" /etc/wsl.conf

And it is better to shutdown WSL completely (wsl.exe --shutdown) and start it again.

Replacing all enables with true might be a little risky, no? (Yes, in the standard issue container there are only 2 enabled params and this would only enable the one we want). Anyways, I manually edited my wsl.conf and saw
... [automount] enabled=false ...
So I changed the automount to true.

This did not fix the issue, same symptoms.

And yes, I always do use wsl.exe --shutdown after making changes.

Thanks for the suggestions though, @stargriv. You mentioned also modifying your ExecStart, what did you change?

@stargriv
Copy link

Can you enable "automount" in wsl-vpnkit with:
wsl.exe -d wsl-vpnkit --cd /app sed -i -- "s/enabled=false/enabled=true/" /etc/wsl.conf
And it is better to shutdown WSL completely (wsl.exe --shutdown) and start it again.

Replacing all enables with true might be a little risky, no? (Yes, in the standard issue container there are only 2 enabled params and this would only enable the one we want). Anyways, I manually edited my wsl.conf and saw ... [automount] enabled=false ... So I changed the automount to true.

This did not fix the issue, same symptoms.

And yes, I always do use wsl.exe --shutdown after making changes.

Thanks for the suggestions though, @stargriv. You mentioned also modifying your ExecStart, what did you change?

I just added GVPROXY_PATH before starting the wsl-vpn itself:

$grep ExecStart /etc/systemd/system/wsl-vpnkit.service
ExecStart=/mnt/c/Windows/system32/wsl.exe -d wsl-vpnkit --cd /app GVPROXY_PATH=/mnt/c/Users/my_user/wsl-vpnkit/wsl-gvproxy.exe wsl-vpnkit

@blakeduffey
Copy link
Author

FYI - microsoft/WSL#10812 (comment)

@typhoe
Copy link

typhoe commented Dec 3, 2023

And pre-release WSL 2.0.14 seems to fix the issue (I have not tested it yet)
https://github.com/microsoft/WSL/releases/tag/2.0.14

Disable the 'NoRemoteImages' process mitigation policy since it breaks execution of windows executables

@duncan485
Copy link

Updating wsl to 2.0.14 seems to do the trick for me.

@blakeduffey
Copy link
Author

2.0.14 is now official release

@fbertini
Copy link

fbertini commented Jan 9, 2024

Thanks a lot! performing the following command to update to last version:
wsl --update --web-download
Basically, even if wsl-vpnkit was up and running, it still couldn't reach any IP outside my network

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