WSL icon indicating copy to clipboard operation
WSL copied to clipboard

ERROR: CreateProcessCommon:717: chdir(/mnt/c/WINDOWS/system32) failed 2

Open m24h opened this issue 6 months ago • 8 comments

Windows Version

Microsoft Windows [10.0.19045.5854]

WSL Version

2.5.7.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

No response

Distro Version

Ubuntu 22.04

Other Software

No response

Repro Steps

just type "wsl"

C:\WINDOWS\system32>wsl <3>WSL (757 - Relay) ERROR: CreateProcessCommon:717: chdir(/mnt/c/WINDOWS/system32) failed 2

Expected Behavior

The expected behavior is like WSL with path parameters added: No error exists

C:\WINDOWS\system32>wsl ~ johnny@vv:~$ exit

Actual Behavior

I can understand this error "CreateProcessCommon:717: chdir(/mnt/c/WINDOWS/system32) failed 2", because on my system, the correct case-sensitive path looks like this:

johnny@vv:/$ cd /mnt/c/WINDOWS/system32 -bash: cd: /mnt/c/WINDOWS/system32: No such file or directory johnny@vv:/$ cd /mnt/c/Windows/System32 johnny@vv:/mnt/c/Windows/System32$

It doesn't seem like WSL gets the correct case-sensitive path, if the path parameter isn't explicitly appended and WSL needs to get the working path by itself.

Importantly, this error path appears to be coming from windows, and when I open Prompt or Power Shell as an Administrator, the system gives us the wrong case path at the beginning :

C:\WINDOWS\system32>cd \windows\system32 C:\WINDOWS\system32>cd
C:>cd WINDOWS C:\Windows>cd system32 C:\Windows\System32>

Hopefully WSL will consider that this will happen with Windows and correct it.

Diagnostic Logs

No response

m24h avatar Jun 05 '25 21:06 m24h

This issue seems to be causing the Docker Desktop error as well:

[2025-06-05T19:41:42.948619700Z] [19:41:42.948619700Z][main.wslprovisioner ] WSLBootstrap: running 'wsl C:\WINDOWS\System32\wsl.exe -d docker-desktop -u root -e wsl-bootstrap run --base-image /c/Program Files/Docker/Docker/resources/docker-desktop.iso --cli-iso /c/Program Files/Docker/Docker/resources/wsl/docker-wsl-cli.iso --data-disk fb203b67-4a8e-9a42-92bf-a6b3c88b6bfc' [2025-06-05T19:41:42.952936800Z] [19:41:42.952760500Z][main.wslprovisioner ] WSLBootstrap: waiting [2025-06-05T19:41:43.110238700Z] [19:41:43.109693800Z][main.WSLBootstrap ] <3>WSL (16 - Relay) ERROR: CreateProcessCommon:717: chdir(/mnt/host/c/WINDOWS/system32) failed 2

m24h avatar Jun 05 '25 22:06 m24h

/logs

OneBlue avatar Jun 06 '25 00:06 OneBlue

WslLogs-2025-06-08_13-22-09.zip

The logs was attached. But I don't think it makes much sense, it's a case-sensitive misunderstanding between the two systems. Especially when you open the window as an administrator, the WINDOWS\system32 directory you stayed looks like some kind of fixed string, and the problem is mainly on the windows side.

C:\Windows>echo %windir% C:\WINDOWS

If you want to solve this problem in terms of WSL, I would suggest making a better translation, listing children of each level of directory, and matching it with original path element in a case-insensitive way, and then choose the matched one to replace the original path element.

m24h avatar Jun 08 '25 05:06 m24h

Diagnostic information
.wslconfig found
Detected appx version: 2.5.7.0

github-actions[bot] avatar Jun 08 '25 05:06 github-actions[bot]

Thank you for reporting this @m24h. Interestingly, I can't reproduce the issue. How did you get WSL to start with the "wrong" current directory casing ?

OneBlue avatar Jun 09 '25 18:06 OneBlue

I don't know how "to start with the wrong current directory casing" either, I just opened Windows Prompt as an Administrator and it was started in such a directory. Even if I modified the shortcut, it seems that there is no way for Administrator to start from another specified directory.

Maybe you should try the Power Shell, it seems like you should be able to reproduce the issue, as the directory it will go into is just copied from the string after the cd command.

PS C:\WINDOWS\system32> cd C:\WinDOWs\SysTem32 PS C:\WinDOWs\SysTem32> wsl <3>WSL (588 - Relay) ERROR: CreateProcessCommon:717: chdir(/mnt/c/WinDOWs/SysTem32) failed 2 Welcome to Ubuntu 24.04.2 LTS (GNU/Linux 6.6.87.1-microsoft-standard-WSL2 x86_64)

m24h avatar Jun 09 '25 19:06 m24h

I also don't have a repro for this:

PS C:\Windows\System32> cd WINDOWS
Set-Location: Cannot find path 'C:\Windows\System32\WINDOWS' because it does not exist.
PS C:\Windows\System32> cd
PS C:\Users\crloewen> cd WINDOWS
Set-Location: Cannot find path 'C:\Users\crloewen\WINDOWS' because it does not exist.
PS C:\Users\crloewen> cd C:\WINDOWS
PS C:\Windows> wsl

/mnt/c/Windows
❯
PS C:\Windows> cd system32
PS C:\Windows\System32> wsl

/mnt/c/Windows/System32
❯
PS C:\Windows\System32>

craigloewen-msft avatar Jun 10 '25 21:06 craigloewen-msft

It's interesting. Try this? It works on my Windows Prompt and Power Shell.

d:>python -c "import os; os.chdir(r'c:\winDOWs'); os.system('cmd')" c:\winDOWs> c:\winDOWs>python --version Python 3.13.0

Maybe your version of Windows can correct the inappropriate case of file/directory.

m24h avatar Jun 10 '25 22:06 m24h

I found out what's causing the issue. It's docker. If you uninstall it (sudo apt purge docker*) the issue doesn't exist anymore.

vB6DasdE avatar Aug 14 '25 16:08 vB6DasdE