microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.35k stars 815 forks source link

Cannot launch bash (nor wsl) from PowerShell #4988

Closed NicolasCast closed 8 months ago

NicolasCast commented 4 years ago

Hi,

Ubuntu's bash (installed as Windows Sub System) cannot be started from PowerShell. The error ois CommandNotFoundException

The (only ?) problem is that the bash command is not in PowerShell'path. Indeed, Ubuntu's bash runs OK when started in its own console from the Windows's start menu.

I guess it is a rather simple problem... !

Additionnal remarks : Ubuntu 18 was installed from the Windows Store, in WindowsSubSystem. The installation process runned smooth.

(I ll add other infos, like WIndows version, later ; but I do not have the computer right now)

Thanks much !

sirredbeard commented 4 years ago

Did you try bash.exe or wsl --distribution...?

Which build of Windows and PowerShell are you on?

image

DHowett-MSFT commented 4 years ago

You are using x86 PowerShell on ARM64 or AMD64.

NicolasCast commented 4 years ago

Thanks for your answers.

@sirredbeard I confirm that in powershell none of the following commands start (CommandNotFoundException) :

Conversely:

Windows' release is :

PowerShell's version is ($PsVersionTable) :

=> it seems that PS build version differs from Windows' ?)

@DHowett-MSFT : CPU is intel Core i7 - 8750H (not ARM nor AMD).

non related comment: I am sorry that I used quite some time to come back to you. Indeed, the issue occurs on one of my students' computer, which I can't access directely. Just to let you know : we are starting advising WSL for all of our many students in programming, in the context of today's "stay at home" situation. So, BTW, thanks to all contributors for the very promising Windows feature !

DHowett-MSFT commented 4 years ago

Thanks! Can you get the output of...

$env:PROCESS_ARCHITECTURE

?

NicolasCast commented 4 years ago

Hi again,

Last news : in powershell : bash.exe and wsl.exe run OK.

Conversely, the same commands but w/o .exe fail.

Now, to answer your questions : In powershell : $env:PROCESS_ARCHITECTURE prints nothing.

$Env:Path contains : C:\WINDOWS\system32; (which is where bash lies on another (bug-free) machine.)

Finally, in cmd.exe where.exe bash prints : C:\Windows\System32\bash.exe

I still dunno why we have this behaviour, but well, at least the student can work ! As far as I am concerned, and though I would be happy to know the trick, the issue could be closed. Thanks much.

microsoft-github-policy-service[bot] commented 8 months ago

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!