WSL
WSL copied to clipboard
WSL2: VHD file vanished after Windows 11 restart
Windows Version
10.0.22631.4169
WSL Version
2.3.24.0
Are you using WSL 1 or WSL 2?
- [X] WSL 2
- [ ] WSL 1
Kernel Version
5.15.153.1-2
Distro Version
ubuntu 24.04
Other Software
Docker desktop is installed as well with WSL support.
Repro Steps
Start WSL in cmd: wsl
Expected Behavior
My default Ubuntu distribution should start.
Actual Behavior
Failed to attach disk 'C:\Program Files\WSL\system.vhd' to WSL2 Error code: Wsl/Service/CreateInstance/CreateVm/MountVhd/HCS/ERROR_FILE_NOT_FOUND
It happened after a Windows restart 1 hour ago. I don't see any updates from Windows Update in the log for today.
Could someone tell if I can recover my VMs from this event, or even how to freshly restart a new Ubuntu VM? For now, even if I try wsl install <distroName>, I get the same error vhd 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'.
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:
- WSL missing system.vhd (#11162), similarity score: 0.83
- wsl startup failed after windows update Error code: Wsl/Service/CreateInstance/CreateVm/MountVhd/HCS/ERROR_NOT_FOUND (#11253), similarity score: 0.80
- WSL_E_DISK_CORRUPTED (#10996), similarity score: 0.77
- Cannot access WSL after reboot (#10464), similarity score: 0.77
- WSL2 is failing to attach the wsl virtual disk and giving error code 4294967295 (#10390), similarity score: 0.76
Note: You can give me feedback by thumbs upping or thumbs downing this comment.
For now I got a VHD file copy from a colleague, and it works again.
Same thing happened to me. I'm dead in the water now.
This just happened for me too, and I had SSH keys that are non-recoverable setup inside my WSL instance (as well as the code from my work, which I now cannot access). Thankfully, most of the code (minus some recent work) is hosted on a remote gitlab server, but now I have to go through the rigamarole to re-provision a key so I can read/write from the repositories. But I now cannot access our remote production servers for emergency maintenance because the SSH keys were setup inside WSL and not saved anywhere else (due to security practices)
This seriously has impacted my work, and I'll probably have to buy a second computer and setup Linux on bare metal as I'm not confident I can trust WSL/Windows for work after this.
EDIT: After conferring with my work's sysadmin, I'll probably continue to use WSL but will store keys encrypted on a USB drive and offsite in an encrypted store. They really do not like having copies of sensitive/critical information laying around, but due to this issue we'll have to adapt our business policies.
2nd EDIT: I was able to re-gain access to my existing data by following downgrading, as referenced here. I immediately backed up my keys and data onto my windows disk, and will be creating the encrypted backups referenced in my prior edit.
Thanks @Xuroth downgrading solved it for me too
Downgrading to 2.1.4 works for me
Having the same problem after updating to 2.3.24. Downgraded to 2.2.4 and it works.
It just happened today for two developers. Automatic upgrade to 2.4.1.11 after a Windows reboot removed the system.vhd
Come on...
same here on a Windows 11 Entreprise 23H2 (10.0.22631.4751) : the 'system component' WSL updated by itself to 2.4.11.0 and removed the system.vhd: how hell such a thing can happen? I don't see how I can downgrade. I am asking a colleague for a copy of the missing file.
Same here. Without colleagues, how do I recreate that vhd? I didn't have anything important in it, but so far, trying to reinstall wsl always fails.
Same here. Without colleagues, how do I recreate that vhd? I didn't have anything important in it, but so far, trying to reinstall wsl always fails.
Installing the 2.5.1 prerelease MSI worked.
For now I got a VHD file copy from a colleague, and it works again.
The transplant surgery actually works lol.
Same thing happend to me. Luckily I have uploaded most of my commits yesterday. I think people who use the wsl for work should carefully consider to have a backup before the issue resolves.
Same here. WSL automatically updates to version 2.4.13.0, and then it fails with:
Failed to attach disk 'C:\Program Files\WSL\system.vhd' to WSL2: The system cannot find the file specified.
I fixed it by reverting to version 2.4.12.0, but just in case, I found the VHD under \HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss BasePath folder.
It doesn't seem specifically related to version 2.4.13.0, as there are multiple open issues on https://github.com/microsoft/WSL/issues/11288#issuecomment-1992080697
It's not the first time it happens to me. Really annoying.
👍 Me too.
How I resolved the issue:
- Check your version: wsl --version, WSL version: 2.6.1.0
- Download the .MSI from github for that version. https://github.com/microsoft/WSL/releases/tag/2.6.1
- Second mouse click to the .msi after it's downloaded and select "Repair".
👍 Me too.
How I resolved the issue:
1. Check your version: wsl --version, WSL version: 2.6.1.0 2. Download the .MSI from github for that version. https://github.com/microsoft/WSL/releases/tag/2.6.1 3. Second mouse click to the .msi after it's downloaded and select "Repair".
This worked for me! I have been banging my head on this for a few days, and simply using wsl --install and variant approaches didn't work. I didn't know about the ability to select "Repair" on the .msi file. This finally re-created the vhd file.
What I did specifically was:
- Download the latest .msi file
- Install it. This only took a couple seconds.
- Right-click the .msi and select "Repair". This took a little while to complete.