WSL after upgraded to version: 2.5.9.0, got issue of "Failed to attach disk 'C:\Program Files\WSL\system.vhd"
Windows Version
10.0.26100.4061
WSL Version
2.5.9.0
Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
Kernel Version
6.6.87.2-1
Distro Version
Ubuntu version 2404.1.68.0
Other Software
docker --version Docker version 26.1.4, build 5650f9b
Repro Steps
Try to run WSL or click Ubuntu icon to start it
Expected Behavior
WSL works
Actual Behavior
Failed to attach disk 'C:\Program Files\WSL\system.vhd' to WSL2: The system cannot find the file specified. Error code: Wsl/Service/CreateInstance/CreateVm/MountDisk/HCS/ERROR_FILE_NOT_FOUND
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 script will output the path of the log file once done.
If this is a networking issue, please use collect-networking-logs.ps1, following the instructions here
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 [email protected] 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'.
Same here. Automatic upgrade of WSL2 took place without my consent. Tried to reinstall ubuntu and it deleted my entire distro, including the user disk. I am furious.
Same issue. Rocky linux.
Same here - happened about 2 hours ago. Now, I cannot get wsl to work or install. I've tried unregister and then reinstall, but this is what I get:
PS C:\Users\nixt> wsl --install --distribution Ubuntu-24.04 Downloading: Ubuntu 24.04 LTS Installing: Ubuntu 24.04 LTS Failed to attach disk 'C:\Program Files\WSL\system.vhd' to WSL2: The system cannot find the file specified. Error code: Wsl/InstallDistro/Service/RegisterDistro/CreateVm/MountDisk/HCS/ERROR_FILE_NOT_FOUND PS C:\Users\nixt>
I searched a bit and found the way to solve it was downgrade the wsl version. I don't know how to downgrade. And then I uninstalled Ubuntu from window; uninstalled wsl by run this command in PowerShell: wsl --uninstall
After that I re-installed them by running: wsl --install -d Ubuntu-22.04
Now everything works well.
The bad thing is that I need to reset everything for the project, like the SSH keys, credentials, API key, GitHub keys...
My issue was my VM folder (one containing .vhdx file) somehow got moved to One Drive- no idea how that happened. But simply cut/pasting it to desired path solved the problem completely for me.
@Shelly-Alcumus I'd like to request to keep this issue open for a while.
@sskhan39 Thanks for your solution and it is useful for future reference! No problem to keep this open for a while.
I've encountered this issue twice now. Seems to be a known issue: #11069
I've been able to fix it both times by downloading the .msi installer from the Releases page on this repo, using 7-Zip to extract the .vhd file, and then copying it into the expected location manually.
There is a way to install version 2.5.9 by temporarily downgrading WSL: https://github.com/microsoft/WSL/issues/13133#issuecomment-2982687910
You don’t need to run wsl --unregister or uninstall WSL itself—just click the installer.
With this method, you can avoid the issue without losing any data.
The upgrade on my device resulted in 2 VHD files which went missing from disk. The following steps were executed to resolve the issue:
-
Downloaded current release installer
wsl.2.5.9.0.x64.msifrom https://github.com/microsoft/WSL/releases/ -
Unsuccessfully tried installing the MSI on top of my current installation and therefor decided to manually copy the following files in the correct places:
wsl.2.5.9.0.x64.msi\cab2.cab\system.vhdtoC:\Program Files\WSL\system.vhdwsl.2.5.9.0.x64.msi\cab4.cab\modules.vhdtoC:\Program Files\WSL\tools\modules.vhd
Thanks @thomasgeens , that worked!
For anyone else following along at home, to extract the files from the .msi, open a PowerShell window in your downloads folder and run something like msiexec /a wsl.2.5.9.0.x64.msi /qb TARGETDIR="C:\Users\<user>\Downloads\extracted", then copy the two files mentioned above.
Can confirm . 2.5.8 > 2.5.9 update breaks. Rollback works
After getting the same issue, I installed the 2.6.0.0 msi and it resolves the issue. https://github.com/microsoft/WSL/releases/download/2.6.0/wsl.2.6.0.0.x64.msi
The upgrade on my device resulted in 2 VHD files which went missing from disk. The following steps were executed to resolve the issue:
- Downloaded current release installer
wsl.2.5.9.0.x64.msifrom microsoft/WSL/releases- Unsuccessfully tried installing the MSI on top of my current installation and therefor decided to manually copy the following files in the correct places:
wsl.2.5.9.0.x64.msi\cab2.cab\system.vhdtoC:\Program Files\WSL\system.vhdwsl.2.5.9.0.x64.msi\cab4.cab\modules.vhdtoC:\Program Files\WSL\tools\modules.vhd
valid fix!