WSL & Windows

How to Fix WSL CreateVm/HCS/ERROR_FILE_NOT_FOUND on Windows

You reboot Windows, open your Ubuntu terminal, and nothing starts. Every distro throws the same wall of text: WSL CreateVm ERROR_FILE_NOT_FOUND. This guide shows…

How to Fix WSL CreateVm/HCS/ERROR_FILE_NOT_FOUND on Windows
Share:

How to Fix WSL CreateVm/HCS/ERROR_FILE_NOT_FOUND on Windows

9 min read
13.2K views

You reboot Windows, open your Ubuntu terminal, and nothing starts. Every distro throws the same wall of text: WSL CreateVm ERROR_FILE_NOT_FOUND. This guide shows you why it happens and how to get your distros back without intentionally changing distro data. The setup here is WSL2 with Ubuntu on Windows 11, and the fix commands run in Windows PowerShell because the broken pieces live on the Windows side of WSL.

The full error looks like this:

Advertisement
The system cannot find the file specified.
Error code: Wsl/Service/CreateInstance/CreateVm/HCS/ERROR_FILE_NOT_FOUND
Press any key to continue...

What this error actually means

WSL2 runs your Linux distros inside a tiny, lightweight virtual machine (think of it as a small computer that Windows boots up in the background just for Linux). To start that machine, WSL needs a few disk image files. If one of those files is missing, the machine can’t power on, and Windows reports ERROR_FILE_NOT_FOUND.

The giveaway is that the error hits every distro, not just one. If only a single distro failed, the problem would be that distro’s own data. When all of them fail at the CreateVm stage, the shared engine is the suspect, not your Ubuntu files.

What causes it

When the WSL virtual machine boots, it attaches two disk image files (files ending in .vhd, which are virtual hard disks). If either one goes missing, the boot fails:

Advertisement
File Where it lives What it is
system.vhd C:\Program Files\WSL\system.vhd The WSL system image (about 374 MB)
modules.vhd C:\Program Files\WSL\tools\modules.vhd The Linux kernel modules image (about 167 MB)

One possible explanation is: a WSL update runs in the background and asks for a restart to finish swapping files. If that restart gets put off for a while, the update can be left half-done. On the next boot, the old copies of system.vhd and modules.vhd are removed, but the new copies never land. The result is exactly this error. In the reported case, the evidence pointed to an incomplete update; this error alone does not rule out other causes.

Here is what that timeline looked like in a real case, pieced together from the Windows Application log:

When What happened
A few days earlier WSL engine files (wsl.exe and friends) updated normally. No problem yet.
Evening, a WSL update ran The installer logged events 1029 and 1038 (restart required, restart deferred). The large .vhd files were queued to be replaced on the next boot.
Next restart The queued swap did not finish: the old system.vhd and modules.vhd were removed, but the new ones never got written.
First launch after reboot Every distro failed with CreateVm/HCS/ERROR_FILE_NOT_FOUND.

If you want to confirm the same story on your machine, check the installer events in your Application log:

Get-WinEvent -FilterHashtable @{ LogName='Application'; ProviderName='MsiInstaller' } |
  Where-Object { $_.Message -match 'Subsystem for Linux' } |
  Select-Object -First 10 TimeCreated, Id, Message | Format-List

Look for a restart required entry (event 1038) that was never followed by a clean completion. Worth knowing: in this case Windows Defender logged no threat detections and no quarantines for these files, which did not provide evidence of antivirus involvement.

Environment used in this guide

Here are the exact versions this fix was tested on. The fix is not tied to these specific numbers, so it works on other recent builds too. The one rule that matters: the installer you pull the files from must match your installed WSL version (covered in the steps below).

Component Version
Windows edition Windows 11 Pro
Windows feature version 25H2 (build 10.0.26200.8390)
WSL 2.7.8.0
WSL kernel 6.18.33.1-1
WSLg 1.0.73.2
MSRDC 1.2.6676
Linux distro Ubuntu 24.04.1 LTS (Noble Numbat)

How to check your own versions

Run these so you know what you are working with before you start.

WSL, kernel, and WSLg versions (in Windows PowerShell):

wsl --version

Your Windows edition and feature version:

(Get-CimInstance Win32_OperatingSystem).Caption
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").DisplayVersion

Your Ubuntu version:

wsl -d Ubuntu-24.04 cat /etc/os-release
  • wsl --version: prints the WSL, kernel, and WSLg versions in one go
  • (Get-CimInstance Win32_OperatingSystem).Caption: shows your Windows edition (for example Windows 11 Pro)
  • wsl -d Ubuntu-24.04 cat /etc/os-release: prints the distro name and version (swap in your own distro name)

Prerequisites

  • WSL2 with a distro already installed (if you are starting fresh, see How to Install Ubuntu 22.04 in WSL2 on Windows)
  • Administrator access on Windows (the files live under C:\Program Files)
  • An internet connection to download the matching WSL installer

Before repair, export each distro to a backup location with enough free space. Choose the exact name from wsl --list --verbose. If export fails because the engine cannot start, stop and secure an offline copy of the existing distro disk after shutting WSL down; do not reset or unregister it. See also checking WSL disk-space use.

wsl --list --verbose
wsl --shutdown
wsl --export Ubuntu-24.04 "D:\Backups\Ubuntu-24.04-before-repair.tar"
if ($LASTEXITCODE -ne 0) { throw "Export failed; secure an offline backup before repair" }

Step-by-Step Guide

Step 1: Confirm the files are actually missing

Open Windows PowerShell and check whether the two files exist:

Test-Path "C:\Program Files\WSL\system.vhd"
Test-Path "C:\Program Files\WSL\tools\modules.vhd"

If either prints False, you have found the problem. The kernel (C:\Program Files\WSL\tools\kernel) is usually still there, which is why wsl --version still works even though no distro will start.

Step 2: Download the matching WSL installer

Use Microsoft’s WinGet download command to fetch the exact version without installing it. Set $ver to the package version matching wsl --version (for example, WSL 2.7.8.0 uses package version 2.7.8). This example is for x64; use arm64 on Windows on ARM. Do not substitute the latest release if the matching package is unavailable.

wsl --version
$ver = Read-Host "Matching WinGet package version (for example 2.7.8)"
$arch = "x64"
$download = Join-Path $env:TEMP "wsl-download-$ver-$arch"
New-Item -ItemType Directory -Path $download -Force | Out-Null
winget download --id Microsoft.WSL --exact --source winget --version $ver --architecture $arch --installer-type wix --download-directory $download --accept-source-agreements --accept-package-agreements
if ($LASTEXITCODE -ne 0) { throw "Download failed; stop here" }
$packages = @(Get-ChildItem $download -Filter *.msi)
if ($packages.Count -ne 1) { throw "Expected exactly one MSI; inspect the download" }
$msi = $packages[0].FullName

Step 3: Extract the two files from the installer

Instead of installing, unpack the installer into a temporary folder. The /a flag runs an administrative extract, which just copies the files out without registering anything:

$ext = Join-Path $env:TEMP "wsl-extract-$ver-$arch"
$process = Start-Process msiexec.exe -ArgumentList "/a `"$msi`" /qn TARGETDIR=`"$ext`"" -Wait -PassThru
if ($process.ExitCode -ne 0) { throw "Extraction failed: $($process.ExitCode)" }
$source = Join-Path $ext "PFiles64\WSL"
$installed = "C:\Program Files\WSL"
if ((Get-FileHash "$source\tools\kernel").Hash -ne (Get-FileHash "$installed\tools\kernel").Hash) {
    throw "Kernel hash mismatch; do not copy files"
}

The extracted layout above is from the tested MSI. Stop if either image or the kernel is missing. Matching kernel hashes are an extra consistency check; also confirm the installer version and architecture. A matching size alone does not establish that two kernels are identical.

Step 4: Copy the files into place

Run PowerShell as Administrator for this step, since the destination is under C:\Program Files:

wsl --shutdown
$source = Join-Path $ext "PFiles64\WSL"
$installed = "C:\Program Files\WSL"
foreach ($relative in @("system.vhd", "tools\modules.vhd")) {
    $src = Join-Path $source $relative
    $dst = Join-Path $installed $relative
    Copy-Item $src $dst -Force -ErrorAction Stop
    if ((Get-FileHash $src -Algorithm SHA256).Hash -ne (Get-FileHash $dst -Algorithm SHA256).Hash) {
        throw "Restored file hash mismatch: $relative"
    }
}

Keep the same PowerShell session so the variables remain available. If opening a new elevated session, set them again to the verified extraction paths before copying.

Advertisement

Step 5: Restart WSL and test

Shut WSL down fully so it picks up the restored files, then launch your distro:

wsl --shutdown
wsl -d Ubuntu-24.04 -- echo "WSL is back"
  • wsl --shutdown: stops the WSL virtual machine so it reloads cleanly
  • wsl -d Ubuntu-24.04 -- echo "WSL is back": starts your distro and runs a quick test command (replace the name with your own distro)

If you see WSL is back, you are done. Your files were never touched, because these commands target the shared WSL engine rather than the distro disk. Distro disks can live in different locations; Microsoft documents how to locate a distro’s ext4.vhdx. You can reopen your projects in your editor right away, for example with VS Code connected to WSL2.

How to confirm the cause for yourself

If you want proof before you start copying files, it helps to rule out the usual suspects first. In most cases of this specific error, all of the following are already fine, which points straight at the missing disk files:

  • The hypervisor is running: (Get-CimInstance Win32_ComputerSystem).HypervisorPresent returns True
  • The required Windows features are on: check with dism /online /get-featureinfo /featurename:VirtualMachinePlatform in an elevated prompt
  • The kernel and your distro disk both still exist on disk

In the reported case, wsl --update said WSL was up to date and did not restore the files. This is an observation, not a guarantee about every WSL release. Back up first, then consider the installed app’s Repair option in Windows Settings if available; avoid Reset or unregistering a distro because those can remove data.

How to prevent it next time

  • When WSL or Windows asks for a restart after an update, reboot soon rather than putting it off for days. A long-delayed restart is what leaves the update half-applied.
  • If WSL breaks right after a reboot, check system.vhd and tools\modules.vhd first, before trying a full reinstall.
  • Always restore files from an installer that matches your installed version, so the disk images line up with your kernel.

Let an AI agent do the repair for you

The steps above are not hard, but they are fiddly, and you are usually doing them while annoyed that nothing works. If you use an AI coding assistant, you can hand it the whole repair instead. Think of it as a written runbook the assistant follows, so it checks the version match and verifies the copy instead of trusting that it worked.

If you use Claude Code, save this as .claude/skills/wsl-vhd-doctor/SKILL.md:

---
name: wsl-vhd-doctor
description: Repair WSL when every distro fails with CreateVm/HCS/ERROR_FILE_NOT_FOUND. Restores the missing system.vhd and modules.vhd from a version-matched installer.
---

# WSL VHD Doctor

Every distro failing with CreateVm/HCS/ERROR_FILE_NOT_FOUND usually means a
half-applied WSL update deleted two platform files. Restore them from an installer
that matches the installed version exactly.

## Confirm the diagnosis before touching anything

- `Test-Path "C:\Program Files\WSL\system.vhd"` and
  `Test-Path "C:\Program Files\WSL\tools\modules.vhd"` both return False
- `wsl --version` still prints a version, so the kernel survived
- EVERY distro fails, not just one. A single failing distro is a different problem.

Record the version `wsl --version` reports. The installer must match it exactly.

## Restore

1. Ask me before making any change. Follow the manual guide’s backup procedure first.
   If export fails, stop until an offline backup of the existing distro disk is secured.
2. Record installed version and architecture. Use the same exact-version
   `winget download --id Microsoft.WSL --exact --source winget --version VERSION
    --architecture ARCH --installer-type wix --download-directory DOWNLOAD_DIR`
   flow from the manual guide. Do not rely on a failed install or a guessed cache path.
3. Extract the one downloaded MSI with `msiexec /a`; wait for completion and check
   the exit code. Locate `PFiles64\WSL` and confirm both VHDs exist.
4. Verify exact package version and architecture, then compare extracted and installed
   kernel SHA256 hashes. Stop on any mismatch or missing file.
5. Run `wsl --shutdown` before copying. Request elevation only for the copy.
6. Compare source and destination SHA256 hashes for each restored image.
7. Start the chosen distro and confirm it boots. Change nothing else.

## Make the next time trivial

Keep both files somewhere permanent, in a folder named after the version, along with
their SHA256 sums. When this happens again the repair is two Copy-Item lines and no
download.

## Rules

- Never copy these files from a different WSL version.
- Treat the update behavior as a case observation, not a universal repair guarantee.
- Never delete or modify a distro disk, unregister a distro, or use Reset as part of this repair.

Then run /wsl-vhd-doctor and let it work through the checks.

Not using Claude Code? The same text works as a plain prompt. Paste everything from “Every distro failing” to the end into ChatGPT, Claude, or Copilot Chat, and tell it what wsl --version printed.

One caution worth repeating: the version match is the part an assistant is most likely to get wrong, because it will happily grab the newest installer. Check that the downloaded kernel file matches the one already on your machine before any copying happens. That single check is what keeps a repair from turning into a bigger mess.

Conclusion

The CreateVm/HCS/ERROR_FILE_NOT_FOUND error looks scary, but it usually comes down to two disk image files that an interrupted update left behind. Restore system.vhd and modules.vhd from the matching WSL installer, restart WSL, and your distros come straight back with all your data intact. If you run into other WSL hiccups after this, take a look at resolving internet connection issues in WSL2 or fixing high VSCode memory usage on WSL2.

Recommended for Linux builders

Contabo VPS hosting for Linux projects

Run Linux servers, automation tools, and self-hosted apps on a Contabo VPS with generous resources and predictable pricing.

Our customers sayExcellent4.6 out of 5 based on 11,008 reviews Trustpilot

Some links are affiliate links. This may earn LinuxBeast a commission at no extra cost to you.

Privacy settings

Choose which privacy controls to open.

Opening these controls does not change your saved choices.