sakai135 / wsl-vpnkit

Provides network connectivity to WSL 2 when blocked by VPN
MIT License
2.3k stars 168 forks source link

Error when attempting to setup Systemd #219

Open jpierson-at-riis opened 1 year ago

jpierson-at-riis commented 1 year ago

Reproduction steps:

  1. Open shell for existing distro (Ubuntu).
  2. Paste in the first command specified in the README.md under Setup systemd.
    wsl.exe -d wsl-vpnkit --cd /app cat /app/wsl-vpnkit.service | sudo tee /etc/systemd/system/wsl-vpnkit.service
  3. Press enter to run the command.

Expected results: The wsl-vpnkit.service should be created according to documentation in the README.md.

Actual results: The following error occurs.

There is no distribution with the supplied name.
Error code: Wsl/Service/WSL_E_DISTRO_NOT_FOUND
> wsl --version
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.19044.3086
> wsl --list
Windows Subsystem for Linux Distributions:
Ubuntu-20.04 (Default)
Diagano commented 1 year ago

Hi, please note that wsl.exe -d wsl-vpnkit Specifically refers to the wsl-vpnkit as distro. So if you did not import this first it will fail. So this step is if you placed this as distro in which case you need to extract wsl-vpnkit.service from the image. In this use case you skip the next two instructions (They are for standalone)

#Skip these
sudo cp ./wsl-vpnkit.service /etc/systemd/system/
sudo nano /etc/systemd/system/wsl-vpnkit.service

Continue to enable the service\start and check the status of the service Anyway, I hope I am not missleading, this is how this use case wroked for me.

jpierson-at-riis commented 1 year ago

Thank you @Diagano, after playing around with things and making a lot of guesses I was able to get this working. I'm still testing out the reliability and consistency of the solution though but I'll try to make a PR for the README.md with some suggestions to better help guide those who may be new to this project and unfamiliar with the intricacies of the different options.