microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.47k stars 822 forks source link

Can't launch Arch in WSL. (/bin/sh not found, failed to mount C:\) #12237

Closed dquevid closed 1 week ago

dquevid commented 1 week ago

Windows Version

Microsoft Windows [Version 10.0.22631.4317]

WSL Version

2.3.24.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.153.1-2

Distro Version

Arch 2024.11.01-x86_64

Other Software

No response

Repro Steps

  1. Download Arch bootstrap tarball from official sources.
  2. Extract with bsdtar (specify compressing algorithm if the tarball is compressed) then archive to a simple tarball again using GNU tar.
  3. Import bootstrap into WSL.
    wsl.exe --import Arch $env:USERPROFILE\Documents\Arch arch-bootstrap.tar
  4. Launch wsl distro.
    wsl.exe -d Arch

Expected Behavior

Bash execution in root environment.

Actual Behavior

<3>WSL (9) ERROR: CreateProcessParseCommon:763: Failed to translate C:\Users\david
<3>WSL (9) ERROR: CreateProcessParseCommon:809: getpwuid(0) failed 2
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Windows\system32
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Windows
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Windows\System32\Wbem
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Windows\System32\WindowsPowerShell\v1.0\
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Windows\System32\OpenSSH\
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Program Files\Git\cmd
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Users\david\AppData\Local\Microsoft\WindowsApps
<3>WSL (9) ERROR: UtilTranslatePathList:2852: Failed to translate C:\Users\david\AppData\Local\Programs\Microsoft VS Code\bin
Processing fstab with mount -a failed.
Failed to mount C:\, see dmesg for more details.

<3>WSL (9) ERROR: CreateProcessCommon:392: getpwuid(0) failed 2
<3>WSL (9) ERROR: CreateProcessCommon:559: execvpe(/bin/sh) failed: No such file or directory

Screenshot of error messages

Diagnostic Logs

WslLogs-2024-11-04_14-35-24.zip wmic_output.txt

dquevid commented 1 week ago

Debian launches without any problems. The problem is only with Arch.

github-actions[bot] commented 1 week ago

View similar issues

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

Diagnostic information
Detected appx version: 2.3.24.0

dquevid commented 1 week ago

In my previous issue Can't boot Arch. Failed to translate Windows env variables and failed to mount disk partitions (#11567) the problem was solved using wsl.conf. However, now it is not the case it seems.

dquevid commented 1 week ago

Nevermind, i fixed the issue. I just injected wsl.conf file into the bootstrap while rearchiving it, and it just worked, even though it didn't for multiple times.

For those wondering, here are the steps i follow to prepare the bootstrap (you will need at least Debian/Ubuntu installed to do this):

Image Image Image