microsoft/WSL

Can't boot Arch. Failed to translate Windows env variables and failed to mount disk partitions

dquevid opened this issue · 13 comments

Windows Version

Microsoft Windows [Version 10.0.22631.3527]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 1
  • WSL 2

Kernel Version

5.15.146.1-2

Distro Version

Arch 2024.05.01

Other Software

No response

Repro Steps

  1. Get latest arch release from https://archive.archlinux.org/iso/
  2. extract root_x86_64 from tarball and pack all its contents into new tarball (e.g arch.tar.gz)
  3. wsl --import Arch path/to/Arch path/to/arch.tar.gz
  4. wsl -d Arch

Expected Behavior

Arch linux bootup

Actual Behavior

PS C:\WINDOWS\system32> wsl -d Arch
<3>WSL (10) ERROR: CreateProcessParseCommon:711: Failed to translate C:\WINDOWS\system32
<3>WSL (10) ERROR: CreateProcessParseCommon:757: getpwuid(0) failed 2
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\VulkanSDK\1.3.275.0\Bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\VulkanSDK\1.3.261.1\Bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Python311\Scripts\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Python311\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\VulkanSDK\1.3.250.0\Bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Windows\system32
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Windows
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Windows\System32\Wbem
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Windows\System32\WindowsPowerShell\v1.0\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Windows\System32\OpenSSH\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files (x86)\QuickTime\QTSystem\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Microsoft SQL Server\150\Tools\Binn\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\nodejs\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\ProgramData\chocolatey\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\VSCodium\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\system32
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\Wbem
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\WindowsPowerShell\v1.0\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\WINDOWS\System32\OpenSSH\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\dotnet\
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\LLVM\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\.cargo\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\scoop\shims
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\AppData\Local\Microsoft\WindowsApps
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\.dotnet\tools
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\.deno\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\AppData\Roaming\npm
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\AppData\Local\Microsoft\WinGet\Packages\Gyan.FFmpeg_Microsoft.Winget.Source_8wekyb3d8bbwe\ffmpeg-6.1-full_build\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Program Files\PostgreSql\15\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\AppData\Local\Microsoft\WindowsApps
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\.dotnet\tools
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\AppData\Local\Programs\Microsoft VS Code\bin
<3>WSL (10) ERROR: UtilTranslatePathList:2866: Failed to translate C:\Users\david\AppData\Local\Microsoft\WinGet\Packages\equalsraf.win32yank_Microsoft.Winget.Source_8wekyb3d8bbwe
Processing fstab with mount -a failed.
Failed to mount C:\, see dmesg for more details.
Failed to mount D:\, see dmesg for more details.

<3>WSL (10) ERROR: CreateProcessEntryCommon:334: getpwuid(0) failed 2
<3>WSL (10) ERROR: CreateProcessEntryCommon:505: execvpe /bin/sh failed 2
<3>WSL (10) ERROR: CreateProcessEntryCommon:508: Create process not expected to return

Diagnostic Logs

No response

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

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.

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

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.

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

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.

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

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.1.5.0

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to wsl-gh-logs@microsoft.com with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

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.

@dquevid importing archlinux-bootstrap into wsl work okay. Just make sure you repackage the contents of root.x86_64 w/out including the folder name.

Here are the commands I use to create a valid arch-wsl.rootfs:

wget https://archive.archlinux.org/iso/2024.05.01/archlinux-bootstrap-x86_64.tar.zst
zstd -d archlinux-bootstrap-x86_64.tar.zst
tar -xvf archlinux-bootstrap-x86_64.tar  
cd root.x86_64/
tar zcvf ../arch-wsl.tar.gz *
cd ..
tar -tf arch-wsl.tar.gz

The last command is just a sanity check of the rootfs archive before importing arch-wsl.tar.gz into wsl

And the end result:

[root@texas ~]# wslinfo --wsl-version
2.2.4
[root@texas ~]# cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
IMAGE_ID=archlinux
IMAGE_VERSION=2024.05.01

@dquevid importing archlinux-bootstrap into wsl work okay. Just make sure you repackage the contents of root.x86_64 w/out including the folder name.

Here are the commands I use to create a valid arch-wsl.rootfs:

wget https://archive.archlinux.org/iso/2024.05.01/archlinux-bootstrap-x86_64.tar.zst
zstd -d archlinux-bootstrap-x86_64.tar.zst
tar -xvf archlinux-bootstrap-x86_64.tar  
cd root.x86_64/
tar zcvf ../arch-wsl.tar.gz *
cd ..
tar -tf arch-wsl.tar.gz

The last command is just a sanity check of the rootfs archive before importing arch-wsl.tar.gz into wsl

And the end result:

[root@texas ~]# wslinfo --wsl-version
2.2.4
[root@texas ~]# cat /etc/os-release
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
ID=arch
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://archlinux.org/"
DOCUMENTATION_URL="https://wiki.archlinux.org/"
SUPPORT_URL="https://bbs.archlinux.org/"
BUG_REPORT_URL="https://gitlab.archlinux.org/groups/archlinux/-/issues"
PRIVACY_POLICY_URL="https://terms.archlinux.org/docs/privacy-policy/"
LOGO=archlinux-logo
IMAGE_ID=archlinux
IMAGE_VERSION=2024.05.01

Thx, but i've already mentioned in the "Repro steps" issue section that i did that.

@dquevid: Based on the error you're seeing the issue is most likely that the tar file isn't made for WSL.

Especially this:

<3>WSL (10) ERROR: CreateProcessParseCommon:757: getpwuid(0) failed 2

Makes me think that there's most likely no /etc/passwd inside the tar.

Unfortunately this is not something that can be fixed from WSL, ideally the archlinux maintainers would need to publish a tar designed for WSL for this to work

@dquevid: Based on the error you're seeing the issue is most likely that the tar file isn't made for WSL.

Especially this:

<3>WSL (10) ERROR: CreateProcessParseCommon:757: getpwuid(0) failed 2

Makes me think that there's most likely no /etc/passwd inside the tar.

Unfortunately this is not something that can be fixed from WSL, ideally the archlinux maintainers would need to publish a tar designed for WSL for this to work

At first i thought the same thing, but after looking for a solution to install Arch on WSL i found this guide, where the author installed it the absolutely same way, and it worked. I tried to do it with both WSL1 and 2, but the result stays the same

@dquevid your issue is with the 2nd command: bsdtar -czaf arch-wsl.tar.gz root.x86_64/* That creates an improper archive.

Quick check:

[elsaco@texas]$ tar -tf arch-wsl.tar.gz | more
root.x86_64/bin
root.x86_64/boot/
root.x86_64/dev/
--- cut ---

bsdtar -czaf will -c create, -z compress, -a auto-compress, and -f write to file, but it won't strip the root.x86_64 from path.

@dquevid your issue is with the 2nd command: bsdtar -czaf arch-wsl.tar.gz root.x86_64/* That creates an improper archive.

Quick check:

[elsaco@texas]$ tar -tf arch-wsl.tar.gz | more
root.x86_64/bin
root.x86_64/boot/
root.x86_64/dev/
--- cut ---

bsdtar -czaf will -c create, -z compress, -a auto-compress, and -f write to file, but it won't strip the root.x86_64 from path.

Yeah, the command provided by the guide was wrong, so i changed it a bit for exactly that purpose like this

cd root.x86_64 && tar czf ../arch.tar.gz *

Although, if it was about incorrect rootfs packing, it couldn't even import it (i tried). The problem was solved when i created wsl.conf file inside the /etc directory in the rootfs. Its contents are:

[automount]
enabled = true
options = "metadata"
mountFsTab = true

After that it booted up perfectly