使用Proxifier 3.x版本 + WSL时遇到0x80070002报错,看Github上问题讨论之后,升级Proxifier至4.x版本,问题解决。

报错信息

报错信息为:

[出现错误 2147942402 (0x80070002) (启动“ubuntu.exe”时)][出现错误 2147942402 (0x80070002) (启动“ubuntu.exe”时)][出现错误 2147942402 (0x80070002) (启动“ubuntu.exe”时)][出现错误 2147942402 (0x80070002) (启动“ubuntu.exe”时)]

截图如下:

wsl信息为:

PS C:\Users\xxx> wsl
The stub received bad data.
Error code: Wsl/Service/0x800706f7
PS C:\Users\xxx> wsl --version
WSL version: 1.2.5.0
Kernel version: 5.15.90.1
WSLg version: 1.0.51
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22621.2283
PS C:\Users\xxx> wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

搜索

放狗搜索:

https://github.com/microsoft/WSL/issues/9413里面好多人反馈遇到了相同问题,其中:

  • MatPoliquin提到运行netsh winsock reset可以解决问题;
  • aaroncnb提到安装某些MDM软件会导致这个问题,而且卸载这个软件没用,只能重新安装操作系统;
  • hgsantana提到,运行netsh winsock reset会导致VPN软件用不了,而修复VPN软件又会导致WSL出问题;
  • bonaluo提到,运行netsh winsock reset起作用,但只有效2~3天,之后就有需要运行。
  • yhvictor指向这个问题,Winsock module breaks WSL2 #4177
  • AbdulAhad10提到上面方法不管用,打开Docker Desktop时仍旧会出现错误;
  • hilmarf指出卸载Symantec Encryption Desktop可以解决这个问题,并且认为WSL should be aware and able to handle different LSPs. Should be enough to just ignore the ones, which are not from Microsoft.

AxisRay提到可以使用如下命令,逐个删除第三方的LSP。他使用这种方法找到了深信服vdi客户端和wsl的某种兼容性问题。

netsh winsock show catalog
netsh winsock remove provider <catalog id>

Winsock module breaks WSL2 #4177里面提到是Proxifier引起的。

Librazy的抓取信息方法:

⚡ 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 ~\..\桌面 ❯❯❯

SwimmingTiger提到安装UU加速器会导致这个问题
After running a game speedup VPN (https://uu.163.com), WSL2 cannot running.

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

1160300208提到,Proxifier的开发者告诉问题原因,并且给出了解决办法:

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.

Mehdi13k8提到,有个beta版本的Proxifier,支持wsl2。我自己打开发现提示404了,然后官网现在推出了v4版本的Proxifier。

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

samuel27m提到,安装 Proxifier v4.01 Beta 2之后,WSL 2 正常工作了。

YanzheL提到了下面这两个链接。
https://github.com/docker/for-win/issues/7208
https://github.com/docker/for-win/issues/7919

arafel 提到某个注册表值修改可以解决问题,但不保证没有副作用:

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

baijifeilong 给出了注册表文件,和一个链接https://baijifeilong.github.io/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

liukaijvhttps://www.noteliu.com/2022/10/14/develop/wsl2%E5%92%8CProxifier%E5%85%BC%E5%AE%B9%E9%97%AE%E9%A2%98/中提到,

使用过Proxifier后,发现wsl2出问题了,打开子系统时提示参考的对象类型不支持尝试的操作。,搜了下网上的解决方法是通过下载NoLsp.exe解决 问题链接:https://github.com/microsoft/WSL/issues/4177#issuecomment-597736482,提供的用不了 这个里的可以用,https://github.com/dyingsu/nolsp 下载

可能的解决办法

升级Proxifier到4.x版本。
实测,卸载3.x版本Proxifier,重启,安装4.x版本Proxifier,WSL正常使用。