navalega0109
navalega0109

Reputation: 400

WSL Error: The file cannot be accessed by the system

Issue Faced:

Even after installing WSL and after running below command, I was getting error: The file cannot be accessed by the system.

  1. wsl --set-default-version 2
  2. Error : The file cannot be accessed by the system

Refer Below Screen Shot enter image description here

Upvotes: 0

Views: 11324

Answers (9)

Chemes Allioua
Chemes Allioua

Reputation: 36

Install the latest version of installation package MSI from the repo:

https://github.com/microsoft/WSL/releases

This solves all your problems!

Upvotes: 0

Araj
Araj

Reputation: 1

Installing the latest wsl package from github worked for me. And It will automatically add the environment variables to the system path.

Upvotes: 0

Dhanay J
Dhanay J

Reputation: 11

Setting Windows PATH resolved my issue . In my case wsl.exe was located in C:\Program Files\WSL\

Upvotes: 0

Timur K
Timur K

Reputation: 121

I realized that to resolve the issue, you need to uninstall WSL 2 with the command:

"C:\Program Files\WSL\wsl.exe" --uninstall

Then, reinstall it using the following commands:

wsl --set-default-version 2
wsl --update

Before using it, it is recommended to run one of the following commands, depending on which subsystem you are using:

wsl --install -d Ubuntu
;or
wsl --install --distribution Debian

The problem, as I understand it, occurs due to differences in the Windows system paths. WSL 1 is located in C:\Windows\system32\wsl.exe, while WSL 2 is in C:\Program Files\WSL\wsl.exe.

Upvotes: 2

Vanny LaRoche
Vanny LaRoche

Reputation: 46

I experienced a similar glitch after a system restore...and I was able to fix it by manually re-installing wsl using the latest package from the link as mentioned in the first solution https://github.com/microsoft/WSL/releases

Upvotes: 0

Chris Christiansen
Chris Christiansen

Reputation: 26

Just pitching in here with a solution variant that worked for me.

  1. Download the latest WSL package from github as suggested by D.B.
  2. Run msiexec /f wsl.2.1.5.0.x64.msi in a command prompt (cd to the dir of the downloaded msi-package or use the full path)

Symptoms in my case. Running wsl/wsl.exe from command promt resulted in The file cannot be accessed by the system.. Could not start wsl2 in any other way either.

Background (if it is of interest): Erroneously deleted some files in Windows\System32, restored them using another PC and then also ran system restore on an earlier restore point. Ran a bunch of repair commands. Ended up with Windows working fine again except wsl.

Upvotes: 0

Yaku
Yaku

Reputation: 1

Here is what worked for me :

  1. I downloaded Revo Uninstaller (the free and portable version) from

https://www.revouninstaller.com/fr/start-freeware-download-portable/

It'll be used it to completely remove WSL.

  1. Unzip the file and Launch the version compatible with your system

  2. Then go to the second tab "Windows Apps" and look for "Windows Subsystem for Linux". Double click on it to completely uninstall it (make sure you checked the "create restore point"). See the image here

  3. When the it's done, a second step will appear with the registry entries related to WSL. Check them all and delete.

  4. Now disable the WSL and Virtual Machine Plateform.

  5. Restart your computer

  6. Re-enable WSL and Virtual Machine Plateform and Restart your computer again and it's OK.

Hope this will help

Upvotes: 0

D. B.
D. B.

Reputation: 1436

I ran into the same issue, presumably after an automatic update.

I tried various things like running dism /Online /Cleanup-Image /RestoreHealth and "repairing" the Windows Subsystem for Linux in Add/Remove Programs without success.

I also tried to update the kernel via wsl --update --web-download and encountered a Catastrophic Failure.

After reading https://superuser.com/questions/1731365/updating-wsl-2-without-microsoft-store I solved the problem as follows.

Solution:

  1. Open Event Viewer & find log Microsoft-Windows-AppXDeploymentServer/Operational
  2. My log stated the following:

AppX Deployment operation failed for package MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.14.0_neutral_~_8wekyb3d8bbwe with error 0x80073D19. The specific error text for this failure is: Deployment of package MicrosoftCorporationII.WindowsSubsystemForLinux_2.0.14.0_x64__8wekyb3d8bbwe was blocked because the provided package has the same identity as an already-installed package but the contents are different. Increment the version number of the package to be installed, or remove the old package for every user on the system before installing this package.

  1. I reinstalled the installed version of wsl via cmdline with the command misexec /package wsl.2.0.14.0.x64

  2. wsl worked as usual

You can download the wsl packages from the wsl github release page https://github.com/microsoft/WSL/releases

Upvotes: 8

navalega0109
navalega0109

Reputation: 400

Solution

To resolve this issue run the below command.

  1. dism /Online /Cleanup-Image /RestoreHealth
  2. Restart the system.

OR

Do followings.

  1. Windows logo key -> type linux -> 'Windows Subsystem for Linuxappears -> you can seeApp Settings` in the right pane, hit that menu.

  2. When Settings windows open, you can see the Reset button. after the reset, It works like a charm!

References: Link

Upvotes: -1

Related Questions