DEV Community

Cover image for Fixing WSL 2.7.x `ERROR_FILE_NOT_FOUND` After an Update
cppchedy
cppchedy

Posted on

Fixing WSL 2.7.x `ERROR_FILE_NOT_FOUND` After an Update

Overview

If you recently updated WSL to version 2.7.x and your distro suddenly fails to start with ERROR_FILE_NOT_FOUND, this article walks through how I diagnosed and fixed the problem.

Spoiler

To save you time, here is the root cause of the error before we dive into the step-by-step fix.

WSL relies on files installed under C:\Program Files\WSL. In this case, the WSL installation was missing system.vhd. The WSL VM therefore could not start because Hyper-V was instructed to attach a virtual disk that did not exist.

How I Fixed WSL 2.7.x ERROR_FILE_NOT_FOUND

Before we start, let's get this out of the way:

Important: This procedure repairs the WSL installation files; it does not unregister or delete your existing distributions. Avoid commands such as wsl --unregister unless you have confirmed that the distribution itself is corrupted and you have a backup.

Assuming you are getting ERROR_FILE_NOT_FOUND, let's first check the Windows services used by WSL:

 Get-Service vmcompute, Wslservice
Enter fullscreen mode Exit fullscreen mode

Windows should display that they are running like the following:

Status   Name               DisplayName
------   ----               -----------
Running  vmcompute          Hyper-V Host Compute Service
Running  Wslservice         WSL Service
Enter fullscreen mode Exit fullscreen mode

Next, let's check if the required windows optional features are also installed and enabled by issuing:

Get-WindowsOptionalFeature -Online | Where-Object FeatureName -match 'VirtualMachinePlatform|Microsoft-Windows-Subsystem-Linux' | Select-Object FeatureName, State
Enter fullscreen mode Exit fullscreen mode

If both features are enabled, we can move on to checking whether the WSL installation itself is missing a required file.

Test-Path "C:\Program Files\WSL\system.vhd"
Enter fullscreen mode Exit fullscreen mode

On my affected installation, this returned False, confirming that system.vhd was missing from the WSL installation directory.

If the file exists, we're likely dealing with a different cause or a different missing file. In that case, the Hyper-V administrator logs can help identify what is actually missing:

Get-WinEvent -LogName "Microsoft-Windows-Hyper-V-Worker-Admin" -MaxEvents 20 | Select-Object TimeCreated, Id, LevelDisplayName, Message | Format-List
Enter fullscreen mode Exit fullscreen mode

In my case, I got a list of events and I identified the following:

//...
TimeCreated      : xx/xx/2026 ...
Id               : 12010
LevelDisplayName : Error
Message          : 'A5071428-32C9-4D4D-A910-79D65B2C5FA5' Synthetic Storage (Instance ID
                   FD1D2CBD-CE7C-535C-966B-EB5F811C95F0): Failed to Power on with Error 'The system cannot find the
                   file specified. ' (0x80070002). (Virtual machine ID A5071428-32C9-4D4D-A910-79D65B2C5FA5)

TimeCreated      : xx/xx/2026 ...
Id               : 12240
LevelDisplayName : Error
Message          : 'A5071428-32C9-4D4D-A910-79D65B2C5FA5': Attachment 'C:\Program Files\WSL\system.vhd (Lun 0)' could
                   not be found due to error: 'The system cannot find the file specified. ' (7864368). (Virtual
                   machine ID A5071428-32C9-4D4D-A910-79D65B2C5FA5)
//...
Enter fullscreen mode Exit fullscreen mode

The logs show that system.vhd is missing. You may encounter other missing files, such as modules.vhd. You can check which VHD files are present in the WSL installation directory with:

Get-ChildItem "C:\Program Files\WSL" -Recurse -Force -Filter "*.vhd" | Select-Object FullName, Length, LastWriteTime
Enter fullscreen mode Exit fullscreen mode

Returning to my case (missing system.vhd), before starting some possible destructive operation, check that your distros are still here.

Next, let's move to fix the problem. First, let's download the MSI WSL package where we can get the system.vhd from (or any other missing file).

Before repairing the installation, I first extracted the MSI and verified that it actually contained system.vhd. This avoids attempting a repair with a package that doesn't contain the file we're looking for.

let's check it by executing:

$ msiexec.exe /a "$env:USERPROFILE\Downloads\wsl.2.7.12.0.x64.msi" /qn  TARGETDIR="$env:TEMP\wsl-2.7.12-admin" 

$ Get-ChildItem "$env:TEMP\wsl-2.7.12-admin" -Recurse -Force | Where-Object { $_.Name -match 'system\.vhd|modules\.vhd' } | Select-Object FullName, Length
Enter fullscreen mode Exit fullscreen mode

The first command execute an "administrative installation"( /a flag) in the target directory. Think of as extracting files respecting installation rules. The /qn means to do it silently without ui.

The second cmd search for system and module vhd files.

After checking that system.vhd exists in the msi file, we issue the following commands:

$ wsl --shutdown 

$ msiexec.exe /fa "$env:USERPROFILE\Downloads\wsl.2.7.12.0.x64.msi" /qn /norestart /l*v "$env:TEMP\wsl-repair.log"
Enter fullscreen mode Exit fullscreen mode

This tells windows to stop wsl. Then forces windows installer to repair the existing WSL installation. The /fa option tells windows installer to repair/reinstall all files from the msi file. /norestart means don't reboot windows automatically. /l*v tells windows installer to write the verbose repair log to the specified file.

Finally, we check if system.vhd is under WSL install folder:

Test-Path "C:\Program Files\WSL\system.vhd"
Enter fullscreen mode Exit fullscreen mode

and we should get True. Last thing is to launch your wsl distro:

wsl -d Ubuntu-26.04
Enter fullscreen mode Exit fullscreen mode

and voila! Fixed! You should have access to your distro terminal now.

Conclusion

We saw multiple interesting commands that can be useful in other fixing/troubleshooting scenarios. Especially, the msi ones where we can repair already installed app.

Top comments (0)