Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot execute bash command in ssh after wsl --update. #10488

Closed
1 of 2 tasks
thelastfantasy opened this issue Sep 19, 2023 · 6 comments
Closed
1 of 2 tasks

Cannot execute bash command in ssh after wsl --update. #10488

thelastfantasy opened this issue Sep 19, 2023 · 6 comments

Comments

@thelastfantasy
Copy link

Windows Version

Microsoft Windows [Version 10.0.19045.3448]

WSL Version

1.2.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.90.1

Distro Version

Ubuntu-20.04

Other Software

No response

Repro Steps

Since my old wsl (wsl 2, version forgot) usually not response to some command like wsl --shutdown, I updated wsl with wsl --update.
But after this update, my vscode from another machine in the LAN cannot connect to this machine any more.
I tested a lot and finally find that ssh connect is all ok, but run bash command(vscode Remote Explorer extension run it automaticlly) returns the ?????????? result.
I also tried run bash command from the wsl host machine, and got the same ?????????? result.

PS C:\Users\To Gyokuryu> ssh 192.168.3.4
PowerShell 7.3.6
PS C:\Users\To Gyokuryu> bash
??????????

Expected Behavior

run bash in ssh should connect the shell successfully of wsl.

Actual Behavior

Got ?????????? after run bash in ssh.

Diagnostic Logs

No response

@OneBlue
Copy link
Collaborator

OneBlue commented Sep 19, 2023

Thank you for reporting this @thelastfantasy. Are you actually calling WSL's bash ? What's the output of 'where bash' ?

Also /logs

@microsoft-github-policy-service
Copy link
Contributor

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

@thelastfantasy
Copy link
Author

thelastfantasy commented Sep 19, 2023

Hello! Could you please provide more logs to help us better diagnose your issue?

To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging

Thank you!

I ran this script but got this.
图片

And finally I got this zip file.
WslLogs-2023-09-19_16-22-46.zip

@thelastfantasy
Copy link
Author

thelastfantasy commented Sep 19, 2023

Thank you for reporting this @thelastfantasy. Are you actually calling WSL's bash ? What's the output of 'where bash' ?

Also /logs

This is result of ran bash with no ssh connection. Shell is Powershell and everything looks OK.
图片

This is result of ran bash after ssh connection. Shell is Powershell setted by:

Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\WindowsApps\Microsoft.PowerShell_7.3.6.0_x64__8wekyb3d8bbwe\pwsh.exe"

图片

@OneBlue
Sorry, but where can I found the logs?
图片

@benhillis
Copy link
Member

Is it possible you were using the inbox version of WSL previously?

With WSL 2.0 you should be able to access wsl.exe and bash.exe from ssh. Could you try updating? wsl.exe --update --pre-release

@benhillis
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants