go-wsl2-host icon indicating copy to clipboard operation
go-wsl2-host copied to clipboard

wsl2host service error:failed to get infos: wsl list all failed: wsl -l -v failed: exit status 1

Open yanhaiqin518 opened this issue 3 years ago • 8 comments

Windows Log -> Application: failed to get infos: wsl list all failed: wsl -l -v failed: exit status 1

yanhaiqin518 avatar Oct 07 '22 07:10 yanhaiqin518

through powershell excute this command is no problem: PS C:\WINDOWS\system32> wsl -l -v NAME STATE VERSION

  • Ubuntu Stopped 2 Ubuntu-20.04 Running 2 docker-desktop Stopped 2 docker-desktop-data Stopped 2

yanhaiqin518 avatar Oct 07 '22 07:10 yanhaiqin518

我也是这个问题,我写了个bash script来自动更新,试试? see: iamqiz/bash-wsl2-host: bash script to Automatically update your Windows hosts file with the WSL2 VM IP address https://github.com/iamqiz/bash-wsl2-host

iamqiz avatar Nov 19 '22 12:11 iamqiz

Wsl2host is broken in latest update of windows 11 (Only work in debug mode, service mode result in wsl -l -v error and cannot obtain ip address of wsl.). I wrote a script in linux to complete the job, see: https://github.com/bayard/WSL2_UPDATE_HOSTS

bayard avatar Nov 30 '22 08:11 bayard

see: berndgz/wsl2hosts: Bash script to automatically update your Windows hosts file with the WSL2 VM IP address and name. https://github.com/berndgz/wsl2hosts

berndgz avatar Feb 23 '23 14:02 berndgz

Same here :/ Right now I'm able to make it working by calling wsl2host.exe run right after WSL start. Latest development version is needed: https://github.com/shayne/go-wsl2-host/releases/tag/latest

rufik avatar Apr 19 '23 08:04 rufik

I wanted to automate the running of wslhost.exe run, so I made a powershell script which is run by ~/.zshenv or ~/.bash_profile (so not that often) which makes a Windows Event Log. Then made a Scheduled Task which runs wslhost.exe run when that event occurs.

Everything works fine, but a terminal window opens up briefly while wsl2hosts runs, which is annoying. I can't hide it by running as the SYSTEM account as it doesn't work ☹️

eggbean avatar Sep 10 '23 14:09 eggbean

The systemctl script run upon network interface changes after ip address change. Bash profile only triggers only after you login via ssh/telnet. So systemctl is the best choice.

bayard avatar Sep 10 '23 16:09 bayard

@bayard Yes, using a systemd service is a much better idea, but I still cannot use cmdow to hide the go-wsl2-host window without run being the default action, as it won't take arguments.

It does seem to do it by default when double-clicking the executable, so if anybody could fix that, that would be cool.

@bayard I am using your solution now, which works nicely. The only small downside is having to make the hosts file user writable. I have made a PR for a couple of minor changes. Cheers.

eggbean avatar Sep 12 '23 09:09 eggbean