Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WSL2 stopped working with error The system cannot find the path specified

WSL2 stopped working suddenly. If I do a new installation of linux distros. Then it throws the following error, when I click launch button for the linux distro from play store:

Installing, this may take a few minutes... 
WslRegisterDistribution failed with error: 0x80070003
Error: 0x80070003 The system cannot find the path specified.

the wsl --help command works properly. All other wsl command hangs or throws error as shown below like wsl -l command throws this error The system cannot find the path specified.

like image 291
Nehal Damania Avatar asked Nov 20 '20 01:11

Nehal Damania


People also ask

Why is wsl not recognized?

The term 'wsl' is not recognized as the name of a cmdlet, function, script file, or operable program. Ensure that the Windows Subsystem for Linux Optional Component is installed. Additionally, if you are using an ARM64 device and running this command from PowerShell, you will receive this error.

How do I force WSL2?

To see whether your Linux distribution is set to WSL 1 or WSL 2, use the command: wsl -l -v . To change versions, use the command: wsl --set-version <distro name> 2 replacing <distro name> with the name of the Linux distribution that you want to update.

How to fix the system cannot find the path specified error?

Running an outdated system can cause various issues to your system, including the "the system cannot find the path specified" error. Follow the steps below to upgrade your Windows: Open the Settings app on your system by pressing and holding Windows + I keys. From Settings, go to Update & Security > Windows Update.

Why can't I access WSL using \\WSL$ on Windows?

A 9p protocol file server provides the service on the Linux side to allow Windows to access the Linux file system. If you cannot access WSL using \\wsl$ on Windows, it could be because 9P did not start correctly. To check this, you can check the start up logs using: dmesg |grep 9p, and this will show you any errors.

Where are the files inside of WSL2 stored?

The files inside cannot be directly explored from Windows at the moment. If one has not moved the file anywhere else, it is stored here: %LOCALAPPDATA%\Packages\<PackageFamilyName>\LocalState\ext4.vhdx Before reinstalling the OS, after taking the backup, I wanted to test if this backup runs fine on new install of WSL2.

Where is the virtual hard disk of WSL2 Linux?

This file is the Virtual Hard Disk of WSL2 Linux. The files inside cannot be directly explored from Windows at the moment. If one has not moved the file anywhere else, it is stored here: %LOCALAPPDATA%\Packages\<PackageFamilyName>\LocalState\ext4.vhdx


Video Answer


2 Answers

I had the same thing happening to me after I moved the directory of my distro.

You have to unregister the distro from WSL;

wslconfig /u Ubuntu-20.04

and then just execute the installed exe and install the whole distro to WSL again.

like image 90
baltermia Avatar answered Oct 19 '22 18:10

baltermia


I had to reinstall the windows to fix the issue. Something got corrupted in the OS. However, before reinstalling the OS as I had lot of work stored in the WSL2, I took the backup of the entire WSL2 image, the big .vhdx file. This file is the Virtual Hard Disk of WSL2 Linux. The files inside cannot be directly explored from Windows at the moment. If one has not moved the file anywhere else, it is stored here: %LOCALAPPDATA%\Packages\<PackageFamilyName>\LocalState\ext4.vhdx

Before reinstalling the OS, after taking the backup, I wanted to test if this backup runs fine on new install of WSL2. For that, I tested it on another machine, by installing the same Ubuntu WSL2 distro and replacing the .vhdx file created with the backup file. It ran fine. So, it felt safe to do entire OS reinstall and then reinstalling WSL2 Ubuntu and finally replacing the .vhdx file with the old backup .vhdx file. So, I did loose some time. But, my data and all the applications/programs on WSL2 were intact.

like image 44
Nehal Damania Avatar answered Oct 19 '22 18:10

Nehal Damania