WSL icon indicating copy to clipboard operation
WSL copied to clipboard

WSL after upgraded to version: 2.5.9.0, got issue of "Failed to attach disk 'C:\Program Files\WSL\system.vhd"

Open huifeng-zhou-veriforce opened this issue 6 months ago • 9 comments

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

huifeng-zhou-veriforce avatar Jun 18 '25 02:06 huifeng-zhou-veriforce

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

github-actions[bot] avatar Jun 18 '25 02:06 github-actions[bot]

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.

swoodvitsoe avatar Jun 18 '25 08:06 swoodvitsoe

Same issue. Rocky linux.

sskhan39 avatar Jun 18 '25 14:06 sskhan39

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>

xinyert avatar Jun 18 '25 18:06 xinyert

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

huifeng-zhou-veriforce avatar Jun 18 '25 19:06 huifeng-zhou-veriforce

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 avatar Jun 18 '25 19:06 sskhan39

@sskhan39 Thanks for your solution and it is useful for future reference! No problem to keep this open for a while.

huifeng-zhou-veriforce avatar Jun 18 '25 20:06 huifeng-zhou-veriforce

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.

camerondm9 avatar Jun 18 '25 22:06 camerondm9

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.

RyutaSato avatar Jun 19 '25 01:06 RyutaSato

The upgrade on my device resulted in 2 VHD files which went missing from disk. The following steps were executed to resolve the issue:

  1. Downloaded current release installer wsl.2.5.9.0.x64.msi from https://github.com/microsoft/WSL/releases/

  2. 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.vhd to C:\Program Files\WSL\system.vhd wsl.2.5.9.0.x64.msi\cab4.cab\modules.vhd to C:\Program Files\WSL\tools\modules.vhd

thomasgeens avatar Jun 20 '25 08:06 thomasgeens

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.

EidoJ avatar Jun 20 '25 15:06 EidoJ

Can confirm . 2.5.8 > 2.5.9 update breaks. Rollback works

suikast42 avatar Jul 01 '25 13:07 suikast42

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

craigjones-dev avatar Jul 01 '25 19:07 craigjones-dev

The upgrade on my device resulted in 2 VHD files which went missing from disk. The following steps were executed to resolve the issue:

  1. Downloaded current release installer wsl.2.5.9.0.x64.msi from microsoft/WSL/releases
  2. 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.vhd to C:\Program Files\WSL\system.vhd wsl.2.5.9.0.x64.msi\cab4.cab\modules.vhd to C:\Program Files\WSL\tools\modules.vhd

valid fix!

ShinobiWPS avatar Jul 09 '25 11:07 ShinobiWPS