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

WSL2: (os error 10013) #8

Open
kayg04 opened this issue Jan 31, 2021 · 9 comments
Open

WSL2: (os error 10013) #8

kayg04 opened this issue Jan 31, 2021 · 9 comments

Comments

@kayg04
Copy link

kayg04 commented Jan 31, 2021

Hello, as stated in the previous issue. I'm unable to run wsldhost.exe --daemon nor am I able to run wsldhost.exe <VMID>. Both of them result in the same error which is:

Failed to listen: An attempt was made to access a socket in a way forbidden by its access permissions. (os error 10013)

I have absolutely no idea what could be causing the issue.
My own account is a standard account and I have a separate account which is in the administrator group. I am running the command in an elevated powershell prompt opened as an administrator.

EDIT1:

I downloaded the wsldhost.exe from the build artifact of your latest commit. wsld on the WSL2 instance has been installed using the command specified in the README. Additionally, I have tried excluding the exe from Windows Defender but that hasn't changed the result.

EDIT2:

Running wsld on the WSL2 instance obviously results in:

Cannot connect to wsldhost: Connection timed out (os error 110)
@nbdd0121
Copy link
Owner

Hmm, I guess maybe you couldn't listen on another user's VM's socket? Have you tried to run wsldhost.exe <VMID> in the standard user under which the WSL2 run?

@kayg04
Copy link
Author

kayg04 commented Feb 1, 2021

You're right.

Getting the VMID with hcsdiag list and then using it as the standard user worked.
I also tested if the session would survive a hibernate or not, and it works beautifully.

But I think there would be an issue when I would reboot my PC, I'll have to manually get
the VMID everytime?

@nbdd0121
Copy link
Owner

nbdd0121 commented Feb 1, 2021

Reboot will change VMID so yes.

I believe you don't need to be admin for the API. Can you try to add the standard user into the Hyper-V administrators group to see if hcsdiag list can be run without privilege elevation?

@Kwaadpepper
Copy link

Kwaadpepper commented Apr 23, 2021

I also have this issue using wsl2.
I added my account to Hyper-V Administrator group I still got the same error. (10013)

I have an LDAP account, and I tried with a Local Administrator account (which I putted in Hyper-V admins as you suggested, but without success)
Any ways I cannot run the program the results is:

wsldhost.exe AB4A63F1-79B4-482E-AB9E-2CCD11314700
Failed to listen: Une tentative d’accès à un socket de manière interdite par ses autorisations d’accès a été tentée. (os error 10013)

@kayg04
Copy link
Author

kayg04 commented Jun 2, 2021

Can you try to add the standard user into the Hyper-V administrators group to see if hcsdiag list can be run without privilege elevation?

It does.
I can also run wsldhost.exe without admin privileges after adding myself to the Hyper-V administrators.

Is it possible to just run wsldhost.exe as admin from a standard user account? I don't want to give my account privileges that are not needed.

@nbdd0121
Copy link
Owner

nbdd0121 commented Jun 2, 2021

It certainly is possible, e.g. by launching a service from admin that just report VMIDs, and let wsldhost retrieve VMID from that service.

Unfortunately this would require significant change and I don't have time for that; I also don't use a setup that allows me to test it.

@elebeaup
Copy link

elebeaup commented Sep 8, 2021

The VMID is stored in registry under the key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\HostComputeService\VolatileStore\ComputeSystem. I found it quite by accident.
I can get the VMID via regedit without admin privileges.

@nbdd0121
Copy link
Owner

nbdd0121 commented Sep 8, 2021

Thanks for the note! I'll have a look.

@nbdd0121
Copy link
Owner

nbdd0121 commented Sep 9, 2021

Latest commit on the master branch has switched the VMID retrieval mechanism to registry.

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

4 participants