WSL: Error: "The stub received bad data"

Version

Microsoft Windows [Version 10.0.22000.258]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

5.10.60.1

Distro Version

Ubuntu

Other Software

No response

Repro Steps

When I install “Windows Subsystem for Linux Preview” from Microsoft Store,the following problems will appear when running wsl.

$ ubuntu
The stub received bad data.

Press any key to continue...

There is no problem before “Windows Subsystem for Linux Preview” is installed,and if I uninstall it, wsl is normal again.

Expected Behavior

“Windows Subsystem for Linux Preview” and wsl that have been installed can coexist.

Actual Behavior

wsl can’t start.

Diagnostic Logs

$ wsl.exe --status
Default Distribution: Ubuntu
Default Version: 1
WSL version: 0.48.2.0
Kernel version: 5.10.60.1
WSLg version: 1.0.29
Windows version: 10.0.22000.258
$ wsl -l -v
  NAME         STATE           VERSION
* Ubuntu       Stopped         2
  ArchLinux    Stopped         2

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 37 (2 by maintainers)

Most upvoted comments

@OneBlue You said Winsock reminds me. I think I already know where the problem is, This question originated from https://github.com/microsoft/WSL/issues/4177 This is why this problem only appears for non-English speaking users, because we need proxy.🥲

Cause of problem

I used Nolsp.exe to solve the issue https://github.com/microsoft/WSL/issues/4177 ,and about Nolsp.exe see https://github.com/microsoft/WSL/issues/4177#issuecomment-599035900 This issue may have re-triggered when I installed “Windows Subsystem for Linux Preview” from Microsoft Store.

The solution

Open an administrative command prompt or powershell,run

netsh winsock reset

For me, this has solved the problem and it still works after restarting the system,If it is only temporarily effective for other computers with this problem, recommended to try Nolsp.exe. I can’t reproduce this problem now.

@OneBlue I managed to get it working.

I need to call NoLsp.exe with wslservice.exe in the WindowsStore wsl2 folder additionally along with the wsl.exe. After a reboot, wsl2 works normally.

Thanks!

@OneBlue You said Winsock reminds me. I think I already know where the problem is, This question originated from #4177 This is why this problem only appears for non-English speaking users, because we need proxy.🥲

Cause of problem

I used Nolsp.exe to solve the issue #4177 ,and about Nolsp.exe see #4177 (comment) This issue may have re-triggered when I installed “Windows Subsystem for Linux Preview” from Microsoft Store.

The solution

Open an administrative command prompt or powershell,run

netsh winsock reset

For me, this has solved the problem and it still works after restarting the system,If it is only temporarily effective for other computers with this problem, recommended to try Nolsp.exe. I can’t reproduce this problem now.

If anyone is here because Proxifier automatically configured Winsock for you, this is the solution that reverts the changes that Proxifier made.

How I managed to solve the problem:

> cd "C:\Program Files\WindowsApps\"

Search for some folder that looks like "MicrosoftCorporationII.WindowsSubsystemForLinux ... x64 ...". For me, it was "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe"

Go in and list its files. It should contain "wsl.exe" and "wslservice.exe".

Download https://web.archive.org/web/20220728095911/http://www.proxifier.com/tmp/Test20200228/NoLsp.exe

Open a windows terminal with admin priviledge.

Kill WSL with
> taskkill -IM "wslservice.exe" /F

Run NoLsp.exe on both "wsl.exe" and "wslservice.exe". For me, it was like
> .\NoLsp.exe "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\wsl.exe"

> .\NoLsp.exe "C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.0.0_x64__8wekyb3d8bbwe\wslservice.exe"

Thanks for reporting this @xsm1997.

Can you try following these instructions but instead of calling NoLsp.exe for C:\windows\system32\wsl.exe, can you try calling it for store wsl.exe instead ?

For the latest version of WSL that should be C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemforLinux_0.58.3.0_x64__8wekyb3d8bbwe\wsl.exe (adjust the path to match the version of WSL you have installed)

@OneBlue Registry files before and after solving the problem. I don’t know if it’s useful sock.zip

My problem is solved,thanks for your help. 😁