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…
When updating to WSL version 2.7.x, some users have encountered the `ERROR_FILE_NOT_FOUND` error while trying to start their Linux distribution. The source of the issue is often the absence of a required file, `system.vhd`, in the WSL installation directory `C:\Program Files\WSL`. This file is crucial for the WSL virtual machine to start, as Hyper-V needs to attach this virtual disk.
In the case of an affected installation, running the command `Test-Path C:\Program Files\WSL\system.vhd` returns `False`, confirming the missing file.
To resolve this issue, follow these steps:
1. Verify that the necessary Windows services, `vmcompute` and `Wslservice`, are running without any issues. These services are essential for WSL to function correctly.
2. Check if the required Windows optional features, `VirtualMachinePlatform` and `Microsoft-Windows-Subsystem-Linux`, are installed and enabled. Use the command `Get-WindowsOptionalFeature -Online | Where-Object FeatureName -match VirtualMachinePlatform|Microsoft-Windows-Subsystem-Linux | Select-Object FeatureName, State` to confirm their status.
3. If the `system.vhd` file is missing, it's crucial to ensure that your Linux distributions are still intact and functional. Before proceeding with any fixes, double-check the presence of your distros to avoid losing any data.
4. Download the MSI package containing the missing file, such as `wsl.2.7.12.0.x64.msi`. Before using the package for repair, verify its contents to ensure it includes the required `system.vhd` file. This step helps prevent attempting a repair with an incomplete package.
5. Extract the MSI package and use the command `msiexec.exe /a /qn TARGETDIR=C:\Program Files\WSL` to repair the WSL installation. This process reinstalls the missing `system.vhd` file and other essential components, allowing the WSL virtual machine to start without errors.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.