WSL (Windows Subsystem For Linux) "wsl" command not found

Proman4713 10 Reputation points
2023-09-16T08:50:18.86+00:00

Guys help, I've contacted ms support multiple times and none of the agents have been able to solve the issue.
so, I have Windows Subsystem for Linux (WSL) with Ubuntu installed. yesterday, i tried to install docker, and it was kind of a mess, so i just uninstalled it in every way possible and cleaned all its leftovers, but i also noticed something weird, since yesterday (i dont know if the issue appeared before that, i only noticed it yesterday), the "wsl" command doesnt work!

proman@----:~$ wsl
Command 'wsl' not found, but can be installed with:
sudo apt install wsl

heres my latest attempt

Currently, my WSL/ubuntu shell doesn't even work because of a troubleshooting step that an agent did, where they opened a folder named "CanonicalGroupLimited" (at the path %userprofile%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc) with some stuff after it and set the read-only checkbox (i dont remember if they did this to the whole folder or to a subfolder) to true (it was true for only some subfolders, but they made it completely true). Which probably means we need to manually change every single folder's readonly settings or recreate the folder somehow.

Here's what it currently says if i open wsl from the ubuntu app:

Error code: Wsl/Service/CreateInstance/E_ACCESSDENIED
Access is denied.
Error code: Wsl/Service/CreateInstance/E_ACCESSDENIED
Access is denied.
Error code: Wsl/Service/CreateInstance/E_ACCESSDENIED
Press any key to continue...

And here's what it says when I open it from the Windows Subsystem for Linux app:

Access is denied.
Error code: Wsl/Service/CreateInstance/E_ACCESSDENIED
Press any key to continue...

 

Both are the same message, except that the ubuntu app repeats it.

If you need any more details please let me know, otherwise, please help as now I'm completely unable to use WSL

Note: I've been so frustrated that i reinstalled wsl and ubuntu (just as a last try) before posting this question, and it now runs normally, but now we're back at square one: the 'wsl' command is not found

This does help though as now we know that my installation of docker wasn't the problem, does anyone know how i can fix it?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
12,075 questions
Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,823 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2023-09-16T08:50:18.86+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    The "wsl" command not found error can occur due to various reasons, including issues with the installation of WSL or its components. Since you have already reinstalled WSL and Ubuntu, we can assume that the issue is not with the installation. One possible cause of this issue is that the "wsl" command is not in your system's PATH environment variable. You can check if this is the case by running the following command in your Ubuntu terminal:

    echo $PATH
    

    If the output does not include the path to the "wsl" command, you can add it to the PATH variable by running the following command:

    export PATH=$PATH:/usr/local/bin
    

    If this does not resolve the issue, you can try resetting the WSL installation by running the following command in PowerShell with administrator privileges:

    wsl --unregister <distribution name>
    

    Replace <distribution name> with the name of your Ubuntu distribution. After running this command, you can reinstall the Ubuntu distribution from the Microsoft Store.


    References:

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.