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

Winsock module breaks WSL2 #4177

Open
Librazy opened this issue Jun 18, 2019 · 64 comments
Open

Winsock module breaks WSL2 #4177

Librazy opened this issue Jun 18, 2019 · 64 comments
Assignees
Labels
wsl2

Comments

@Librazy
Copy link

Librazy commented Jun 18, 2019

For an workaround provided by Proxifier, see #4177 (comment)

Please fill out the below information:

  • Your Windows build number: 10.0.18917.1000

  • What you're doing and what's happening:
    After updating from 1903 to 18917, I upgraded to WSL2 and it works fine. Later, I enabled https://www.proxifier.com/'s winsock module in its "System Setting 64-bit" app, and WSL2 starting to fail with The attempted operation is not supported for the type of object referenced..

⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl
The attempted operation is not supported for the type of object referenced.
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl -l -v
NAME            STATE           VERSION
* Ubuntu-18.04    Running         2
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl --shutdown 
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl -l -v 
NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         2
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl
The attempted operation is not supported for the type of object referenced.
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl -l -v
NAME            STATE           VERSION
* Ubuntu-18.04    Running         2
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl -l -v
NAME            STATE           VERSION
* Ubuntu-18.04    Stopped         2
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl
The attempted operation is not supported for the type of object referenced.
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl -l -v
NAME            STATE           VERSION
* Ubuntu-18.04    Running         2
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl
The attempted operation is not supported for the type of object referenced.

After uninstalling the winsock module, WSL2 launches again. And installing the winsock module won't cause running WSL2 console to fail.

  • What's wrong / what should be happening instead:

WSL2 should work even if there are other winsock modules installed.

lxcore.zip

@benhillis
Copy link
Member

benhillis commented Jun 18, 2019

Thanks for providing a trace, I will take a look.

@benhillis
Copy link
Member

benhillis commented Jun 19, 2019

I took a look at the trace and I'm not seeing any relevant events in the service etl. If possible could you do the following?

wsl.exe --shutdown
start trace
launch distribution
stop trace

@benhillis benhillis added the wsl2 label Jun 19, 2019
@Librazy
Copy link
Author

Librazy commented Jun 20, 2019

Steps I take (In a Chinese environment)
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ wsl.exe --shutdown
⚡ Liqueur Librazy C:\..\system32 ❯❯❯ cd 'C:\Users\Liqueur Librazy\OneDrive\桌面\'
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯ logman.exe create trace lxcore_kernel -p "{0CD1C309-0878-4515-83DB-749843B3F5C9}" -mode 0x00000008 -ft 10:00 -o .\lxcore_kernel.etl -ets                                                                       命令成功结束。
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯ logman.exe create trace lxcore_user -p "{D90B9468-67F0-5B3B-42CC-82AC81FFD960}" -ft 1:00 -rt -o .\lxcore_user.etl -ets                                                                                         命令成功结束。
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯ logman.exe create trace lxcore_service -p "{B99CDB5A-039C-5046-E672-1A0DE0A40211}" -ft 1:00 -rt -o .\lxcore_service.etl -ets                                                                                   命令成功结束。
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯ wsl                                                                                    参考的对象类型不支持尝试的操作。
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯ logman.exe stop lxcore_kernel -ets
命令成功结束。
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯ logman.exe stop lxcore_user -ets
命令成功结束。
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯ logman.exe stop lxcore_service -ets
命令成功结束。
⚡ Liqueur Librazy ~\..\桌面 ❯❯❯

lxcore.zip

@xiaoqidun
Copy link

xiaoqidun commented Jun 27, 2019

same question,proxifier winsock installation,wsl2 can not work.

@yeahnoob
Copy link

yeahnoob commented Jun 30, 2019

Same issue of WSL 2 on my Win10 laptop.

@sticnarf
Copy link

sticnarf commented Jun 30, 2019

Sorry for a useless comment.
Developers in China highly rely on proxies due to poor network condition. I do hope this issue will be resolved soon.

@SwimmingTiger
Copy link

SwimmingTiger commented Jul 3, 2019

The same issue. After running a game speedup VPN (https://uu.163.com), WSL2 cannot running.
Reset winsock can fix it.

PS C:\WINDOWS\system32> wsl.exe --shutdown
PS C:\WINDOWS\system32> wsl.exe
The attempted operation is not supported for the type of object referenced.
PS C:\WINDOWS\system32> netsh winsock reset

Sucessfully reset the Winsock Catalog.
You must restart the computer in order to complete the reset.

PS C:\WINDOWS\system32> wsl.exe
root@TIGERHOMEPC /mnt/c/Windows/System32
  # exit

Build 18922.1000.

@Librazy Librazy changed the title "Proxifier" breaks WSL2 if its Winsock module is installed Winsock module breaks WSL2 Jul 4, 2019
@infdahai
Copy link

infdahai commented Jul 5, 2019

The same issue. After running a game speedup VPN (https://uu.163.com), WSL2 cannot running.
Reset winsock can fix it.

PS C:\WINDOWS\system32> wsl.exe --shutdown
PS C:\WINDOWS\system32> wsl.exe
The attempted operation is not supported for the type of object referenced.
PS C:\WINDOWS\system32> netsh winsock reset

Sucessfully reset the Winsock Catalog.
You must restart the computer in order to complete the reset.

PS C:\WINDOWS\system32> wsl.exe
root@TIGERHOMEPC /mnt/c/Windows/System32
  # exit

Build 18922.1000.

I encounter this problem and use this method to solve. But my proxifier can't be used.

@nimocat
Copy link

nimocat commented Jul 10, 2019

So the problem is, after using any kinds of vpn (such as shadowsocks or whatever), wsl2 will crash when users try to start it. So I think it needs to be compatible with vpns in the future.

@Librazy
Copy link
Author

Librazy commented Jul 22, 2019

Still reproducible on recent insider versions

@xiaoqidun
Copy link

xiaoqidun commented Jul 23, 2019

xiaoqidun_2019-07-23_10-12-16
windows10 18941.1001,this problem is still not fixed。

@Librazy
Copy link
Author

Librazy commented Jul 29, 2019

Still relevant. 10.0.18945.1001

@wrvsrx
Copy link

wrvsrx commented Aug 1, 2019

The problem exists on build 18950.1000.
update: 18956.1000, still here

@zookao
Copy link

zookao commented Aug 12, 2019

still 18956

@xiaoqidun
Copy link

xiaoqidun commented Aug 15, 2019

windows10 18956.1000,this problem is still not fixed。

@Librazy
Copy link
Author

Librazy commented Aug 18, 2019

reproducible in 18963

@JaylonGu
Copy link

JaylonGu commented Aug 21, 2019

18963.1000,this problem is still not fixed。

@DDoSolitary
Copy link

DDoSolitary commented Aug 21, 2019

I don't think it makes any sense to keep reporting the bug is still not fixed, because there hasn't been any claim from Microsoft that it's fixed. It's pretty obvious that the issue is universal and easily reproducible, and it's very likely that Microsoft is already aware of it. So such comments only spam this issue and and the email inbox of those who have subscribed to this issue.

@benhillis
Copy link
Member

benhillis commented Aug 21, 2019

I took a look at the traces and unfortunately there really isn't much to go on other than WSAEOPNOTSUPP being returned when trying to call into the Service com interface. There are no errors originating from our service itself, so I suspect something outside of WSL components is causing the issue.

For people that are hitting this issue, I would suggest looking in the Windows event log or using https://docs.microsoft.com/en-us/sysinternals/downloads/procmon to help track down what is returning the error. Honestly this seems like an error in https://www.proxifier.com/

@Librazy
Copy link
Author

Librazy commented Aug 21, 2019

As many other winsock modules breaks wsl2, I think it is not Proxifier's fault. It is likely that the communication between wsl2 and other components (likely hyperv?) is broken.

I captured events from wsl.exe using procmon when reproducing the issue
Logfile.zip

And there are the windows event logs (system)
wsl4177.evtx.zip

@benhillis
Copy link
Member

benhillis commented Aug 21, 2019

@Librazy - Thanks for the additional logs. Unfortunately as I mentioned before, wsl.exe is not where the errors are coming from. I suspect proxifier and other winsock modules are not correctly handling the Hyper-V socket address family (AF_HYPERV). I would strongly suggest reporting the issue to them.

@craigloewen-msft
Copy link
Member

craigloewen-msft commented Sep 5, 2019

If you're still seeing this error, could you help us diagnose it by collecting networking logs?

Instructions on how to do so are here. Thanks!

@Librazy
Copy link
Author

Librazy commented Sep 7, 2019

@craigloewen-msft Thanks for the instructions and here is the log! https://aka.ms/AA5zzk7

@benhillis
Copy link
Member

benhillis commented Sep 9, 2019

@craigloewen-msft - I am not seeing logs attached to @Librazy's feedback hub issue. Can you investigate?

@craigloewen-msft
Copy link
Member

craigloewen-msft commented Sep 10, 2019

@benhillis Yup! I'll look into it.

@GusRoth
Copy link

GusRoth commented Jun 28, 2020

Proxifier的开发人员告诉了我原因,并给了我一个解决方案。

谢谢(你的)信息。
我们已转载此问题。
显然,如果Winsock LSP DLL被加载到其进程中,则wsl.exe将显示此错误。
最简单的解决方案是对wsl.exe使用WSCSetApplicationCategory WinAPI调用来防止这种情况。
在幕后,该调用在HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ WinSock2 \ Parameters \ AppId_Catalog中为wsl.exe创建一个条目。
这告诉Windows不要将LSP DLL加载到wsl.exe进程中。
我们有一个可以进行此调用的工具:
www.proxifier.com/tmp/Test20200228/NoLsp.exe
请以管理员身份运行,并以wsl.exe的完整路径作为参数:
NoLsp.exe c:\ windows \ system32 \ wsl.exe
这已经解决了我的问题。
请让我知道它如何为您工作。

它对我来说很好!

Developers of Proxifier told me the reason and gave me a solution.

Thanks for the info.
We have reproduced this issue.
Apparently, wsl.exe displays this error if Winsock LSP DLL gets loaded into its process.
The easiest solution is to use WSCSetApplicationCategory WinAPI call for wsl.exe to prevent this.
Under the hood the call creates an entry for wsl.exe at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog
This tells Windows not to load LSP DLLs into wsl.exe process.
We have a tool that can make this call:
www.proxifier.com/tmp/Test20200228/NoLsp.exe
Please just run as admin with the full path to wsl.exe as the parameter:
NoLsp.exe c:\windows\system32\wsl.exe
This has fixed the problem in my case.
Please let me know how it works for you.

And it works well for me!

It‘s the best way to solve this!!! It's works! Even don't need a reboot! Thank you !

@Mehdi13k8
Copy link

Mehdi13k8 commented Jul 28, 2020

For the people using Proxifier like me and if you don't want to do weird stuff on your register,

I had a response from the support of Proxifier, and they responded that their new version still in beta support wsl 2,

I had no issue with my Docker on wsl 2, or on my ubuntu,

www.proxifier.com/beta

@filipepinheiro
Copy link

filipepinheiro commented Aug 20, 2020

Just to let you know that same thing happens with Microsoft Forefront TMG.

@daphyyz
Copy link

daphyyz commented Sep 7, 2020

Developers of Proxifier told me the reason and gave me a solution.

Thanks for the info.
We have reproduced this issue.
Apparently, wsl.exe displays this error if Winsock LSP DLL gets loaded into its process.
The easiest solution is to use WSCSetApplicationCategory WinAPI call for wsl.exe to prevent this.
Under the hood the call creates an entry for wsl.exe at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog
This tells Windows not to load LSP DLLs into wsl.exe process.
We have a tool that can make this call:
www.proxifier.com/tmp/Test20200228/NoLsp.exe
Please just run as admin with the full path to wsl.exe as the parameter:
NoLsp.exe c:\windows\system32\wsl.exe
This has fixed the problem in my case.
Please let me know how it works for you.

And it works well for me!

It saved me. Thanks!

@solxnp
Copy link

solxnp commented Sep 14, 2020

Developers of Proxifier told me the reason and gave me a solution.

Thanks for the info.
We have reproduced this issue.
Apparently, wsl.exe displays this error if Winsock LSP DLL gets loaded into its process.
The easiest solution is to use WSCSetApplicationCategory WinAPI call for wsl.exe to prevent this.
Under the hood the call creates an entry for wsl.exe at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog
This tells Windows not to load LSP DLLs into wsl.exe process.
We have a tool that can make this call:
www.proxifier.com/tmp/Test20200228/NoLsp.exe
Please just run as admin with the full path to wsl.exe as the parameter:
NoLsp.exe c:\windows\system32\wsl.exe
This has fixed the problem in my case.
Please let me know how it works for you.

And it works well for me!

After following the prompts, an error will still be reported

image

image

@samuel27m
Copy link

samuel27m commented Sep 15, 2020

As per @Mehdi13k8 comment, after installing the Proxifier v4.01 Beta 2, WSL 2 works as expected.

@dohq
Copy link

dohq commented Nov 17, 2020

#4177 (comment)
This way I was able to launch it from the command prompt with wsl.exe.
However, I can't seem to start wsl from wsltty, wsl-terminal or windows terminal.

@yangliu2
Copy link

yangliu2 commented Dec 22, 2020

Developers of Proxifier told me the reason and gave me a solution.

Thanks for the info.
We have reproduced this issue.
Apparently, wsl.exe displays this error if Winsock LSP DLL gets loaded into its process.
The easiest solution is to use WSCSetApplicationCategory WinAPI call for wsl.exe to prevent this.
Under the hood the call creates an entry for wsl.exe at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog
This tells Windows not to load LSP DLLs into wsl.exe process.
We have a tool that can make this call:
www.proxifier.com/tmp/Test20200228/NoLsp.exe
Please just run as admin with the full path to wsl.exe as the parameter:
NoLsp.exe c:\windows\system32\wsl.exe
This has fixed the problem in my case.
Please let me know how it works for you.

And it works well for me!

This works to start WSL, but because of the winsock shutdown, it won't connect to the internet. local network works fine. Need to do netsh winsock reset

@pauljohn32
Copy link

pauljohn32 commented Feb 17, 2021

I have 2 company computers. Only one has trouble with WSL. So far as I know, computers are same Windows 10 image. When I try to run wsl, the "bad" computer says

The attempted operation is not supported for the type of object referenced.
Press any key to continue...

If I have an administrator around, they can open PowerShell and run

netsh winsock reset

That solves the problem until the system is forced to reset.

I want to understand why the problem only affects one computer. Both of them have Cisco VPN, but the problem happens whether or not I'm connected to VPN. The versions of Cisco AnyConnect Secure Mobility Client are slightly different, thought. The trouble computer has Cisco 4.9.05042.

I don't have a web proxy, that I know of, but if you tell me what to look for, I can try. I don't have admin authority, hence, I'm totally stuck!

It is possible that the corporate IT applied slightly different security policies on the 2 computers. On the new one, but not the old, I could not get the Ubuntu apps to display onto X11 server without a battle with the firewall. We had to open up both the public and private channels for X410 and Vcxrv to get to the desktop.

Can you help me understand if I have same winsock problem and what program is causing it?

@YanzheL
Copy link

YanzheL commented Mar 25, 2021

I have 2 company computers. Only one has trouble with WSL. So far as I know, computers are same Windows 10 image. When I try to run wsl, the "bad" computer says

The attempted operation is not supported for the type of object referenced.
Press any key to continue...

If I have an administrator around, they can open PowerShell and run

netsh winsock reset

That solves the problem until the system is forced to reset.

I want to understand why the problem only affects one computer. Both of them have Cisco VPN, but the problem happens whether or not I'm connected to VPN. The versions of Cisco AnyConnect Secure Mobility Client are slightly different, thought. The trouble computer has Cisco 4.9.05042.

I don't have a web proxy, that I know of, but if you tell me what to look for, I can try. I don't have admin authority, hence, I'm totally stuck!

It is possible that the corporate IT applied slightly different security policies on the 2 computers. On the new one, but not the old, I could not get the Ubuntu apps to display onto X11 server without a battle with the firewall. We had to open up both the public and private channels for X410 and Vcxrv to get to the desktop.

Can you help me understand if I have same winsock problem and what program is causing it?

Thanks, this command netsh winsock reset also solves docker/for-win#7208 and docker/for-win#7919

@arafel
Copy link

arafel commented Apr 29, 2021

Looks like this magic registry stuff keeps WSL2/winsock combo happy, for at least three of us at work so far.

Disclaimer: works fine for me with no apparent side-effects, but I don't entirely know what it's doing. Use at your own risk...

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\\\\windows\\\\system32\\\\wsl.exe"
"PermittedLspCategories"=dword:80000000

@amtriorix
Copy link

amtriorix commented Jun 14, 2021

Same issue and it solves with the winsock reset. This is another proof that Microsoft is a noob in writing proper software.
"In computing, the Windows Sockets API, later shortened to Winsock, is a technical specification that defines how Windows network software should access network services, especially TCP/IP." A linux shell should run without using tcp/ip communication.

@halinwu
Copy link

halinwu commented Jun 15, 2021

Fixes # I encountered the same problem, I deployed Docker with WLS2 at VDI environment, It could be work at the Golden image, but when use the golden image provision bulk of vms, the docker couldn't work. I searched a lot of info and try to fix the problem. it couldn't work. Now I do the following processes, It 's fine.

  1. Authorize the domain user to control the folder (C:\program files\Docker)
  2. add domain user to a local group ( docker-users)

@H4M5TER
Copy link

H4M5TER commented Jul 1, 2021

I wonder why Winsock LSP DLL gets load into wsl.exe when proxy software (proxifier, game accelerators, whatever) work and what's the meaning of it.
Can we solve the problem simply by blocking Winsock LSP DLL from getting load into it without any side effect?

@FredYakumo
Copy link

FredYakumo commented Sep 15, 2021

The same issue. After running a game speedup VPN (https://uu.163.com), WSL2 cannot running.
Reset winsock can fix it.

PS C:\WINDOWS\system32> wsl.exe --shutdown
PS C:\WINDOWS\system32> wsl.exe
The attempted operation is not supported for the type of object referenced.
PS C:\WINDOWS\system32> netsh winsock reset

Sucessfully reset the Winsock Catalog.
You must restart the computer in order to complete the reset.

PS C:\WINDOWS\system32> wsl.exe
root@TIGERHOMEPC /mnt/c/Windows/System32
  # exit

Build 18922.1000.

I encounter this problem and use this method to solve. But my proxifier can't be used.

This help for me

@baijifeilong
Copy link

baijifeilong commented Apr 18, 2022

  1. Create one file named wsl2.reg (or any other filename with .reg suffix)
  2. Open this file in notepad.exe, pase text below to it.
  3. Save file.
  4. Double click this file, give it Administrator permission
  5. Open wsl.exe

wsl2.reg code, I copied from this issue

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\\\\windows\\\\system32\\\\wsl.exe"
"PermittedLspCategories"=dword:80000000

Or you can download my wsl2.reg directly:

https://baijifeilong.github.io/wsl2.reg

@Adam24866
Copy link

Adam24866 commented Apr 22, 2022

  1. 创建一个名为wsl2.reg(或任何其他带有 .reg 后缀的文件名)的文件
  2. 打开这个文件notepad.exe,将下面的文本粘贴到其中。
  3. 保存存档。
  4. 双击这个文件,给它Administrator权限
  5. 打开wsl.exe

wsl2.reg 代码,我从这个问题复制

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\\\\windows\\\\system32\\\\wsl.exe"
"PermittedLspCategories"=dword:80000000

或者你可以wsl2.reg直接下载我的:

https://baijifeilong.github.io/wsl2.reg

  1. Create one file named wsl2.reg (or any other filename with .reg suffix)
  2. Open this file in notepad.exe, pase text below to it.
  3. Save file.
  4. Double click this file, give it Administrator permission
  5. Open wsl.exe

wsl2.reg code, I copied from this issue

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\\\\windows\\\\system32\\\\wsl.exe"
"PermittedLspCategories"=dword:80000000

Or you can download my wsl2.reg directly:

https://baijifeilong.github.io/wsl2.reg

work for me thx!!

@Cloud0310
Copy link

Cloud0310 commented May 2, 2022

2021 年了,这个问题还没解决,不愧是你,微软

22年了(update)

@typ431127
Copy link

typ431127 commented May 3, 2022

  1. 创建一个名为wsl2.reg(或任何其他带有 .reg 后缀的文件名)的文件
  2. 在 中打开此文件notepad.exe,将下面的文本粘贴到其中。
  3. 保存存档。
  4. 双击这个文件,给它Administrator权限
  5. 打开wsl.exe

wsl2.reg 代码,我从这个问题复制

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\WinSock2\Parameters\AppId_Catalog\0408F7A3]
"AppFullPath"="C:\\\\windows\\\\system32\\\\wsl.exe"
"PermittedLspCategories"=dword:80000000

或者你可以wsl2.reg直接下载我的:

https://baijifeilong.github.io/wsl2.reg

解决了,感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wsl2
Projects
None yet
Development

No branches or pull requests