7

When I open my terminal and run WSL, the following error is shown:

Error shown

The file cannot be accessed by the system.

[process exited with code 1 (0x00000001)]

  • 3
    What research have you done and what have you tried to resolve the issue? Please avoid screenshots of text and instead post your code using the appropriate code tags (e.g. {} button). – mashuptwice Apr 04 '22 at 02:46
  • Reset Windows Terminal. Edit your question to include the necessary information to answer your question – Ramhound Apr 04 '22 at 03:49
  • 2
    From the Stack Overflow question that you posted, I got the impression that this was happening even if you just ran wsl.exe from CMD or PowerShell, right? This version makes it sound like a Windows Terminal problem, but it sounded more like a permissions problem of some sort on the wsl.exe. Could you clarify? Thanks. – NotTheDr01ds Apr 04 '22 at 04:50
  • Updating to the wsl pre-release fixed this for me. See: https://superuser.com/questions/1714736/cannot-run-wsl2-over-ssh-on-windows-11 – John Eikenberry Mar 29 '24 at 20:30

7 Answers7

7

I had the same error in Windows 11 Professional. Seemed to happen after rolling back to a system restore point but I am not absolutely sure what triggered it.

For me, I went to "Settings -> Apps -> Installed Apps -> Windows Subsystem for Linux" and clicked the "Repair" option and this resolved the issue.

chrisb
  • 171
3

I had the same issue after a black screen. This seems to be caused by corruption of the wsl subsystem. It can be fixed running dism cleanup on an elevated shell:

dism /Online /Cleanup-Image /RestoreHealth
  • 1
    I tried this but it did not work for me. I still get "The file cannot be accessed by the system." – Frederik Mar 15 '23 at 11:22
1

Based on your Stack Overflow question and the error you are seeing:

The file cannot be accessed by the system.

I have a hunch this may be related to compressed or encrypted files. Check a couple of things:

  • In Windows Explorer, open %userprofile%\AppData\Local\. Right click on the Temp folder there and select Properties, then the Advanced button. If either "Compress ..." or "Encrypt ..." options are selected, then unselect them.
  • Repeat the same process for the WSL Distribution Package. In Explorer, open %userprofile%\AppData\Local\Packages, find the Canonical...Ubuntu... folder and check if it is encrypted or compressed.

I'm hoping that solves it for you, but if not, we'll need more information/details in your question.

NotTheDr01ds
  • 21,923
1

I got this error and uninstalled WSL and Ubuntu via the Start Menu. Then I installed WSL from the Microsoft Store: https://www.microsoft.com/store/productId/9P9TQF7MRM4R and got less issues.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Jan 03 '23 at 01:12
1

I got this exact same error after restoring windows to previous point, but unfortunately the above methods did not work. This is what worked for me:

  1. Turn on show hidden and system files, in Settings>System>For developers>File Explorer
  2. Go to C:\Program Files, (the hidden folder WindowsApps could not be accessed by my user profile.)
  3. Change ownership/permissions in folder properties > Security > Advanced to give full control

This worked like a charm for me.

Phil
  • 11
0

This is what worked for me:

  1. Uninstall Ubuntu (reboot)
  2. Remove Subsystem from Windows features (reboot)
  3. From the folder C:\Users\yourname\AppData\Local\Packages, search and delete:
    1. CanonicalGroupLimited.Ubuntu18.04onWindows_79rhkp1fndgsc
    2. CanonicalGroupLimited_Ubuntu20_04LTS_79rhkp1fndgsc!ubuntu2004
    3. Microsoft_WSL
  4. Reboot and re-install subsystem (reboot)
  5. Go to M$ store and download LTS.
  6. Reboot for the last time and run Ubuntu to continue the installation.

(I know, too many reboots, but this is how it finally worked for me)

zx485
  • 2,279
-1

I had the same issue and what helped was @chrisb solution. However, in w11 home, the Windows Subsystem for Linux is under "Settings -> System -> System Components -> Windows Subsystem for Linux" and click the repair button.