microsoft / WSL

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

Enable relevant XZ decoding options in kernel by default #11658

Open win32asm opened 4 months ago

win32asm commented 4 months ago

Is your feature request related to a problem? Please describe. Modern distributions (e.g. RH) enable CONFIG_XZ_DEC_X86=y CONFIG_XZ_DEC_POWERPC=y CONFIG_XZ_DEC_IA64=y CONFIG_XZ_DEC_ARM=y CONFIG_XZ_DEC_ARMTHUMB=y CONFIG_XZ_DEC_SPARC=y CONFIG_XZ_DEC_BCJ=y in their kernel configuration. This allows them to mount squashfs filesystems created anywhere. Default WSL kernel returns IO error with a 'helpful' message of

[ 1454.847511] SQUASHFS error: xz decompression failed, data probably corrupt
[ 1454.847907] SQUASHFS error: Failed to read block 0x5c3cb5e: -5

recompiling the WSL kernel with above settings fixes the problem.

Describe the solution you'd like Enabling the kernel compilation options is a low-cost solution not leading to code bloat and allows to process various squashfs entries with default WSL kernel.

Describe alternatives you've considered given that squashfs may come from any source, alternative is to unpack squashfs with userlevel tools before using. squashfs could have high compression ratios, resulting in unneededly high disk usage.

Additional context none

Thanks.

github-actions[bot] commented 4 months ago

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](https://github.com/Microsoft/WSL/blob/master/diagnostics/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](https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-collect-wsl-logs-recommended-method) 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'.
win32asm commented 4 months ago

WslLogs-2024-06-05_09-22-23.zip

win32asm commented 4 months ago

/feature

github-actions[bot] commented 4 months ago
Diagnostic information ``` Found '/feature', adding tag 'feature' ```
github-actions[bot] commented 4 months ago
Diagnostic information ``` .wslconfig found Detected appx version: 2.1.5.0 ```
elsaco commented 4 months ago

CONFIG_SQUASHFS_XZ is already enabled in the WSL2 kernel, along with other XZ options. See details at:

https://github.com/microsoft/WSL2-Linux-Kernel/blob/33cad9854e0b15d9ee50b33a3f457ff31a37b291/arch/x86/configs/config-wsl#L3372

win32asm commented 4 months ago

XZ-enabled squashfs can be mounted, but respective XZ BCJ filtering algorithms are disabled.

From your reference:

CONFIG_XZ_DEC=y
# CONFIG_XZ_DEC_X86 is not set
# CONFIG_XZ_DEC_POWERPC is not set
# CONFIG_XZ_DEC_IA64 is not set
# CONFIG_XZ_DEC_ARM is not set
# CONFIG_XZ_DEC_ARMTHUMB is not set
# CONFIG_XZ_DEC_SPARC is not set
# CONFIG_XZ_DEC_TEST is not set

I believe it is CONFIG_XZ_DEC_X86 that fails in my case.

win32asm commented 4 months ago

For reference: the same issue was encountered before - https://github.com/microsoft/WSL/issues/9668 Recompiling the kernel with CONFIG_XZ_DEC_X86=y solved the problem.