microsoft / WSL

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

Catastrophic failure :Error code: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 #11849

Closed xiezhipeng-git closed 2 months ago

xiezhipeng-git commented 3 months ago

Windows Version

Microsoft Windows [Version 10.0.22631.3958]

WSL Version

2.2.4.0

Are you using WSL 1 or WSL 2?

Kernel Version

5.15.153.1-2

Distro Version

Ubuntu 22.04LTS

Other Software

vscode 1.91.1

Repro Steps

when I writecode on vscode in wsl.Then vscode crashed and restart.then the wsl can not open

Expected Behavior

can open wsl.and can use

Actual Behavior

can not open wsl with vscode and file manger

Diagnostic Logs

https://github.com/user-attachments/files/16402723/WslLogs-2024-07-28_16-56-38.zip

github-actions[bot] commented 3 months ago

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

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!

Open similar issues:

Closed similar issues:

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

Diagnostic information
.wslconfig found
Detected appx version: 2.2.4.0
Found no WSL traces in the logs

xiezhipeng-git commented 3 months ago

Now NodeExecServer run: C:\windows\System32\wsl.exe -d Ubuntu-22.04 -e sh -c if [ -d ~/.vscode-server/bin/f1e16e1e6214d7c44d078b1f0607b2388f29d729 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; if [ -s ~/.vscode-server/bin/compatibilty-check ]; then printf 'legacy-'; fi; uname -m; [2024-07-28 08:46:42.199] Unable to detect if server is already installed: Error: Failed to probe if server is already installed: code: Failed to probe if server is already installed: code: 4294967295, , �e�l\�x�v C:\Users\Admin\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx D��R0R WSL2� �e�Nb�vUcOWN�e�l���S0 [2024-07-28 08:46:42.199] Error code: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 [2024-07-28 08:46:42.199] [2024-07-28 08:46:42.199] NodeExecServer run: C:\windows\System32\wsl.exe -d Ubuntu-22.04 sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" f1e16e1e6214d7c44d078b1f0607b2388f29d729 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=4216714420-1561004773-1456349802-1130381406 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all' [2024-07-28 08:46:42.235] �e�l\�x�v C:\Users\Admin\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx D��R0R WSL2� �e�Nb�vUcOWN�e�l���S0 [2024-07-28 08:46:42.235] Error code: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 [2024-07-28 08:46:42.235] [2024-07-28 08:46:42.235] 有关启动问题的帮助,请转到 https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips [2024-07-28 08:46:52.165] Download in background is enabled This is open vscode info

some other info https://github.com/microsoft/WSL/issues/11840

xiezhipeng-git commented 3 months ago

WslLogs-2024-07-28_18-24-26.zip image

github-actions[bot] commented 3 months ago

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information ``` .wslconfig found Detected appx version: 2.2.4.0 Found no WSL traces in the logs ```
github-actions[bot] commented 3 months ago

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

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
.wslconfig found
Detected appx version: 2.2.4.0
Found no WSL traces in the logs

xiezhipeng-git commented 3 months ago

@https://github.com/neokofg @bterlson @kant @gaia @abergs @chessturo @benhillis @OneBlue

xiezhipeng-git commented 3 months ago

image

xiezhipeng-git commented 3 months ago

wsl status 无法将磁盘“C:\Users\Admin\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx”附加到 WSL2: 文件或目录损坏且无法读取

xiezhipeng-git commented 3 months ago

PS C:\Users\Admin> wsl status 无法将磁盘“C:\Users\Admin\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx”附加到 WSL2: 文件或目录损坏且无法读取。 Error code: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 PS C:\Users\Admin> wsl --status 默认分发: Ubuntu-22.04 默认版本: 2

wsl status 与 wsl --status return diff result and docker file is nomal. wsl ubuntu error

OneBlue commented 3 months ago

/logs

xiezhipeng-git commented 3 months ago

I already upload log image and image @OneBlue

OneBlue commented 3 months ago

You need to collect logs while you reproduce the issue so the error is captured.

/logs

xiezhipeng-git commented 3 months ago

@OneBlue https://github.com/user-attachments/files/16402959/WslLogs-2024-07-28_18-24-26.zip The above log is obtained when opening the VSCode WSL project. The current issue is in a permanent state. When I tried using WSL, it looked like this, and I couldn't open the folder either. I don't know what else I can do to get the logs you want. Enter WSL status? Or open the VSCode WSL project? Below is the use of collect-wsl-logs.s1 Then the WSL status Then collect the logs after collecting wsl-logs.ts1 again try creating. then windows vid.sys blue screen crash. I will try again WslLogs-2024-08-02_20-05-54.zip Does this log contain the necessary information?

github-actions[bot] commented 3 months ago

The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.

Diagnostic information ``` .wslconfig found Detected appx version: 2.2.4.0 Found no WSL traces in the logs ```
xiezhipeng-git commented 3 months ago

WslLogs-2024-08-02_20-05-54.zip @OneBlue Does this log contain the necessary information?

github-actions[bot] commented 3 months ago
Diagnostic information ``` .wslconfig found Detected appx version: 2.3.13.0 Detected user visible error: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 Detected user visible error: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 Detected user visible error: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 Detected user visible error: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 Detected user visible error: Wsl/Service/CreateInstance/MountVhd/HCS/0x80070570 ```
OneBlue commented 3 months ago

Thank you @xiezhipeng-git. Here's the root cause of the error you're seeing:

Microsoft.Windows.Lxss.Manager  Error   08-02-2024 05:06:26.221 "   "   "code:  
failurecount:   13
file:   C:\__w\1\s\src\windows\common\hcs.cpp
function:   
hr:     0x80070570
linenumber:     231
message:    ""HcsWaitForOperationResult for HcsModifyComputeSystem failed ({""""ResourcePath"""":""""VirtualMachine/Devices/Scsi/0/Attachments/2"""",""""RequestType"""":""""Add"""",""""Settings"""":{""""Type"""":""""VirtualDisk"""",""""Path"""":""""C:\\Users\\Admin\\AppData\\Local\\Packages\\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\\LocalState\\ext4.vhdx"""",""""SupportCompressedVolumes"""":true,""""AlwaysAllowSparseFiles"""":true,""""SupportEncryptedFiles"""":true}} - error string: {""""Error"""":-2147023504,""""ErrorMessage"""":""""文件或目录损坏且无法读取。"""",""""ErrorEvents"""":[{""""Message"""":""""“CA4CE02A-643B-4335-8469-4FEC048BC5A3”: 附件“C:\\Users\\Admin\\AppData\\Local\\Packages\\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\\LocalState\\ext4.vhdx”无法打开,因为出现错误“文件或目录损坏且无法读取。”(0x80070570)。(虚拟机 ID CA4CE02A-643B-4335-8469-4FEC048BC5A3)"""",""""Provider"""":""""edacd782-2564-4497-ade6-7199377850f2"""",""""EventId"""":12140,""""Flags"""":5,""""Data"""":[{""""Type"""":""""String"""",""""Value"""":""""CA4CE02A-643B-4335-8469-4FEC048BC5A3""""},{""""Type"""":""""String"""",""""Value"""":""""CA4CE02A-643B-4335-8469-4FEC048BC5A3""""},{""""Type"""":""""String"""",""""Value"""":""""C:\\Users\\Admin\\AppData\\Local\\Packages\\CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\\LocalState\\ext4.vhdx""""},{""""Type"""":""""String"""",""""Value"""":""""%%2147943792""""},{""""Type"""":""""String"""",""""Value"""":""""0x80070570""""},{""""Type"""":""""String"""",""""Value"""":""""""""},{""""Type"""":""""String"""",""""Value"""":""""""""}]}]})""
threadid:   13676
type:   0
wslVersion:     2.3.13.0"   C:\__w\1\s\src\windows\common\hcs.cpp           6172    13676   2       00000000-0000-0000-0000-000000000000        

The error code (0x80070570) is ERROR_FILE_CORRUPT, which points to filesystem corruption. One thing you can try would be to run: chkdsk /f and reboot, but most likely you might have to register the distribution again via wsl --unregister <distro> and install it again, which unfortunately means losing your files.

xiezhipeng-git commented 3 months ago

@OneBlue 你的意思是我需要在cmd里尝试 chkdsk /f 然后重启,这没有任何效果。 然后在尝试wsl --unregister 这个命令吗?那么这个命令会导致文件内容丢失吗?以及暂时我不能执行这个命令。因为该电脑因为英特尔的不定时蓝屏崩溃而送修了。执行这个命令的结果得之后才能了解。然后这个命令有可能会让wsl正常运行而不丢失数据吗? 还有本来就是因为vscode运行中崩溃导致的这个问题。如果你们不能解决。不就意味着任何wsl都有这种随时挂掉并丢失一切文件的可能。那谁还敢用wsl啊。并且我发现1年前我换电脑的时候,原来的电脑也是这个错误,当时什么都没有做,只是正常的某一次开机启动wsl。看起来概率还很高,一年里已经有两个不同版本的 wsl 和ubuntn 遇到这个错误了。 并且。我发现。这个文件ext4.vhdx仍然可以通过diskgenis查看和修改.这说明如果知道是哪里的数据不对。就有可能修复。但是这里需要的内容太多太细了,我自己不能独立解决。

xiezhipeng-git commented 3 months ago

@OneBlue Are you saying that I need to try in cmd Chkdsk/f and then restart, but this has no effect. Then try WSL - Unregister This command? Will this command result in the loss of file content? And I cannot execute this command temporarily. Because the computer was sent for repair due to Intel's intermittent blue screen crash. The result of executing this command can only be understood after. Is it possible for this command to make WSL run normally without losing data? Also, this issue was originally caused by a crash during the running of VSCode. If you cannot solve it. It doesn't mean that any WSL has the possibility of crashing and losing all files at any time. Who dares to use WSL. And I found out that when I changed my computer a year ago, the original one also had this error. At that time, I didn't do anything, just started WSL normally once. It seems that the probability is still high, as two different versions of WSL and Ubuntu have encountered this error within a year. And. I find. This file ext4.vhdx can still be viewed and modified through diskgenis. This indicates that if you know where the data is incorrect. It is possible to repair it. But there is too much and too detailed content needed here, and I cannot solve it independently.

xiezhipeng-git commented 3 months ago

@OneBlue I tried this with my old cumputer wsl that had the similate problem.Neither method worked. image

OneBlue commented 3 months ago

@xiezhipeng-git: The bluescreen errors are most likely what caused the disk corruption in the first place. You can try to run chkdsk /f and then follow these instructions to try to recover the disk but based on the state of your machine I think it' unlikely to work.

The screenshot you sent is a different error code. Can you capture /logs of that please ?

xiezhipeng-git commented 3 months ago

@OneBlue The reason for the different error codes is that the Unregister command was executed.This command directly deletes the file ext4.vhdx.I ran this command on an older computer has the same error with this article.The computer with important data is still in the process of being sent for repair due to an error caused by an untimely Intel blue screen.Then there is no blue screen when something goes wrong,and the old computer never blue screen one times, and the new computer after almost every blue screen I have tried to use chkdsk /f Each time I get 0 errors. 0 fixes.And it has no effect on the /MountVhd/HCS/0x80070570 error!

OneBlue commented 3 months ago

/logs

xiezhipeng-git commented 2 months ago

@OneBlue That's a different computer. And the error only occurs because the command to cancel registration has already been executed. Is submitting that error still meaningful? Additionally, I have discovered. Please take a look at this link. It seems like I was cutting something when VSCode crashed. And then it led to this problem. If you know this information. Is it still possible to fix the vhdx file? And this problem has not been solved at all. It should not have been closed https://blog.csdn.net/ONE_SIX_MIX/article/details/119416091