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

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

Open
yanhaiqin518 opened this issue Oct 7, 2022 · 8 comments

Comments

@yanhaiqin518
Copy link

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

@yanhaiqin518
Copy link
Author

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

@iamqiz
Copy link

iamqiz commented Nov 19, 2022

我也是这个问题,我写了个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

@bayard
Copy link

bayard commented Nov 30, 2022

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

This was referenced Jan 12, 2023
@berndgz
Copy link

berndgz commented Feb 23, 2023

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

@rufik
Copy link

rufik commented Apr 19, 2023

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

@eggbean
Copy link

eggbean commented Sep 10, 2023

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 ☹️

@bayard
Copy link

bayard commented Sep 10, 2023

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.

@eggbean
Copy link

eggbean commented Sep 12, 2023

@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.

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

6 participants