WSL: Installing WSL2 - The term 'wsl' is not recognized as the name of a cmdlet
Windows build number: Microsoft Windows [Version 10.0.18362.295]
Trying to install WSL2 as shown on https://docs.microsoft.com/en-us/windows/wsl/wsl2-install
Executed the Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform, which installed and told me it needs a restart. Later after a restart, when trying the wsl --set-version <Distro> 2 step, it goes
PS C:\Users\Inari> wsl
wsl : The term 'wsl' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ wsl
+ ~~~
+ CategoryInfo : ObjectNotFound: (wsl:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
where.exe wsl or where.exe wsl.exe both find nothing. But I have System32 in my $Env:Path (which was the issue in another issue about this on here). where.exe calc.exe also finds the calc.exe in System32.
Re-running Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform just tells me:
PS C:\Users\Inari> Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
Path :
Online : True
RestartNeeded : False
And then it still doesn’t work
Running a search for wsl.exe finds 8 files:
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.239.1.4\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.18362.239_none_d8d55499606e362e\f\wsl.exe
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.239.1.4\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.18362.239_none_d8d55499606e362e\r\wsl.exe
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.295.1.5\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.18362.239_none_d8d55499606e362e\f\wsl.exe
C:\Windows\servicing\LCU\Package_for_RollupFix~31bf3856ad364e35~amd64~~18362.295.1.5\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.18362.239_none_d8d55499606e362e\r\wsl.exe
C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.18362.239_none_d8d55499606e362e\wsl.exe
C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.18362.239_none_d8d55499606e362e\f\wsl.exe
C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl_31bf3856ad364e35_10.0.18362.239_none_d8d55499606e362e\r\wsl.exe
C:\Windows\WinSxS\amd64_microsoft-windows-lxss-wsl.resources_31bf3856ad364e35_10.0.18362.1_en-us_1e417be3cc84e28a\wsl.exe.mui
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24
This command actually fixed my issue:
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
and then I restarted and it was working
One does not need Powershell nor Powershell core nor Command Prompt to use WSL.
I had this error. The problem was that I opened “PowerShell (x86)” and not “PowerShell”. I wrote the command in the later and it worked.
I have the same problem:
In PowerShelll:
But in Command Promp:
I have done all of the above in Windows [Version 10.0.19041.172]. Reinstalled Ubuntu 18.04. In powershell:
In cmd:
wsl --set-version <Ubuntu-18.04> 2: The system cannot find the file specified.
I have not found anything that fixes this.
@gabrielbino express yourself in plain English
@elena-pascal, this is a known issue, although I didn’t realize it at first. See the “Troubleshooting installation” section here: https://docs.microsoft.com/en-us/windows/wsl/install-win10
PowerShell Core is an official Microsoft tool, just like normal PowerShell, but it doesn’t come pre-installed. You can install PowerShell Core from the Microsoft Store (where it’s simply called PowerShell - confusing!) or download it from GitHub. This article discusses the differences between them if you’re curious.
waste of time
After going through all the suggestion here, the command “wsl --set-default-version 2” still does not work for me in Powershell. Then instead of running in Powershell, I try running on Command Prompt and voila, it works! So probably Powershell pathing may not be updated after all the steps or something like that.
Hope this helps other trying to solve it.
For me, I need to enable two features and reboot my pc twice to make the features ready for the installation of WSL2 Linux kernel update package for x64 machines
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestartdism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestartMy issue was that I was using x86 as well. I used PowerShell ISE instead and it works!
@banderlog | I used the Google translate, sorry if there are glitches.
I solved the problem as follows: 1st restarted the computer, just in case. 2nd I used the following command: “wsl -help”. Then I ran the code that at the beginning had given the above error: “wsl --set-default-version 2”. Then the following appeared: " WSL 2 requires an update to its kernel component. For more information, visit https://aka.ms/wsl2 For information on key differences from WSL 2, visit https://aka.ms/wsl2 " Then I ran the initial command again: “wsl --set-default-version 2” " I solved my problem.
Não entendi o que você quis dizer. Traduzi a frase mas continuei sem entender. De qualquer forma o problema que eu tive foi solucionado.
Abstract
I don’t understand what you mean. I translated the sentence, but I still didn’t understand. Anyway the problem I had was solved.