Skip to content

[BUG] stdin redirection from Windows to Linux not working in 6.18 kernel #40184

@Nevuly

Description

@Nevuly

Windows Version

Windows 11 25H2 (26200.8117)

WSL Version

2.6.3.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

6.18.20.1

Distro Version

Ubuntu 22.04

Other Software

N/A

Repro Steps

  1. Execute WSL2
  2. From windows, run echoi echo hi | wsl -u root sh
  3. Note that no output appears, and the return code from wsl is "1", indicating an error.

Expected Behavior

It should return hi.

C:\Users\User>echo echo hi |  wsl -u root sh
hi

C:\Users\User>

Actual Behavior

Instead of returning hi, it returns an empty string, and when checking the %ERRORLEVEL%, it returns 1.

C:\Users\User>echo echo hi |  wsl -u root sh

C:\Users\User>echo %ERRORLEVEL%
1

For more detailed information, please refer to the link below:
Nevuly/WSL2-Rolling-Kernel-Issue#42

I applied workaround patch in my custom kernel, and stdin redirection work correctly again.
Nevuly/WSL2-Linux-Kernel-Rolling@38b1178

This issue has been occurring since the commit linked below was applied:
Nevuly/WSL2-Linux-Kernel-Rolling@f0c5827

Additionally, there is a note mentioning that a rare interoperability issue between Windows and WSL2 can occur after applying the temporary patch. I am attaching this information as well.
Locietta/xanmod-kernel-WSL2#155

Diagnostic Logs

N/A - You can check WSL side logs in detailed information link.

cc @chessturo
This issue is present in all kernels starting from version 6.17 up to the latest.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions