Encountering this error after installing Ubuntu on WSL (Windows Subsystem for Linux)?
Failed to attach disk‘C:\Users\amar\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04LTS_79rhkp1fndgsc\LocalState\ext4.vhdx’ to WSL2: The system cannotfind the file specified.
Error code:
Wsl/Service/CreateInstance/MountVhd/HCS/ERROR_FILE_NOT_FOUND
Solution: You can solve this by Unregister Linux Distributions.
How to Unregister a Linux Distribution in WSL:
- Open Windows PowerShell as Administrator.
- List Installed Linux Distributions:
- Run the following command:
wsl -l
- Unregister the Distribution:
- Run the command below, replacing
Ubuntu
with your specific distribution name:wsl --unregister Ubuntu
- You should see a message:
The operation completed successfully.
This should help you manage your WSL distributions.
Open the Ubuntu that you installed using WSL
This is how you solve the issue. Enjoy your coding!