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

Failed to install Wsl-IpHandler #35

Closed
dragoangel opened this issue Feb 10, 2023 · 5 comments
Closed

Failed to install Wsl-IpHandler #35

dragoangel opened this issue Feb 10, 2023 · 5 comments

Comments

@dragoangel
Copy link

dragoangel commented Feb 10, 2023

Installation fails on Win11 via Terminal with:

Install-WslIpHandler -WslInstanceName "Ubuntu-22.04" -WslHostName ubuntu -GatewayIpAddress 192.168.31.1 -PrefixLength 25 -WslInstanceIpAddress 192.168.31.2 -DontModifyPsProfile -UseScheduledTaskOnUserLogOn
PowerShell installing Wsl-IpHandler to Ubuntu-22.04...
[sudo] password for admin:
bash: "C:UsersadminDocumentsPowerShellModulesWsl-IpHandlerScriptsBashinstall-wsl-iphandler.sh": No such file or directory
bash: line 1: ping -c1 windows 1>/dev/null && echo 1: No such file or directory
Test-WslInstallation on Ubuntu-22.04 Failed!
PowerShell finished installation of Wsl-IpHandler to Ubuntu-22.04 with Errors:
Pinging windows from WSL Instance: Ubuntu-22.04 failed:

Pinging ubuntu (WSL instance Ubuntu-22.04) from Windows failed.

Looks like escaping is broken somewhere as script trying to run script not via unix path

If I enter same command that fails in Debug, but in CMD:

wsl.exe -d Ubuntu-22.04 sudo -E env '"PATH=$PATH"' DEBUG=1 bash  $(wslpath "C:\Users\admin\Documents\PowerShell\Modules\Wsl-IpHandler\Scripts\Bash\install-wsl-iphandler.sh") "C:\Users\admin\Documents\PowerShell\Modules\Wsl-IpHandler\Scripts\Bash\wsl-iphandler.sh" /usr/local/bin "C:\Users\admin\Documents\PowerShell\Modules\Wsl-IpHandler\Scripts\Powershell\WSL-WinHostsEdit.ps1" /etc/wsl-iphandler.conf windows ubuntu 192.168.31.2

It looks like do not fail.

At the end of debug output:

bash: line 1: ping -c1 windows 1>/dev/null && echo 1: No such file or directory
DEBUG: Test-WslInstallation [1663]: $wslTest:
DEBUG: Test-WslInstallation [1673]: Starting WSL instance Ubuntu-22.04 for testing ping from Windows.
DEBUG: Test-WslInstallation [1681]: $windowsTest result: True
Test-WslInstallation on Ubuntu-22.04 Failed!
PowerShell finished installation of Wsl-IpHandler to Ubuntu-22.04 with Errors:
DEBUG: Install-WslIpHandler [294]: ScriptStackTrace: at Test-WslInstallation, C:\Users\admin\Documents\PowerShell\Modules\Wsl-IpHandler\Wsl-IpHandler.psm1: line 1695
at Install-WslIpHandler, C:\Users\admin\Documents\PowerShell\Modules\Wsl-IpHandler\Wsl-IpHandler.psm1: line 290
at <ScriptBlock>, <No file>: line 1
Pinging windows from WSL Instance: Ubuntu-22.04 failed:
@wikiped
Copy link
Owner

wikiped commented Feb 13, 2023

Thanks for reporting this.

However, it appears that the problem is coming from powershell itself rather that this module. I have submitted the issue at powershell-core repo.

@dragoangel
Copy link
Author

dragoangel commented Feb 13, 2023

Hi @wikiped, thank you!

For meanwhile as a workaround maybe start a cmd and inside of it launch wsl.exe? And after powershell-core fix is applied revert logic back?

@wikiped
Copy link
Owner

wikiped commented Feb 13, 2023

The bug comes with v7.3.*, so meanwhile I would recommend to downgrade powershell to 7.2.9: remove installed version 7.3 - and then install any older version.

@wikiped
Copy link
Owner

wikiped commented Feb 14, 2023

The issue should have been fixed with latest commit. Has been tested to work with both 7.3.2 and 7.2.9.

How to update

@dragoangel
Copy link
Author

dragoangel commented Feb 14, 2023

Tested on both 7.3.2 and 7.2.9 it working as expected, thank you! And version 7.3.* has an active history that can fill commands with just -> arrow, don't won't revert back, killer feature :)

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

2 participants