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

SSH from VScode doesn't work but from terminal SSH works fine. #6316 #6348

Closed
kochargs opened this issue Feb 15, 2022 · 15 comments
Closed

SSH from VScode doesn't work but from terminal SSH works fine. #6316 #6348

kochargs opened this issue Feb 15, 2022 · 15 comments
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH

Comments

@kochargs
Copy link

kochargs commented Feb 15, 2022

I was able to SSH remote windows 10 machine but all of a sudden, I am not able to do it anymore.
I can confirm nothing has changed, no update has been done

Source machine is windows 11 and target machine is windows 10
This setup has been working for me for a few days but now all of a sudden, it stopped.
When I SSH to windows 10 ( target ) from pwsh on windows 11 ( source machine )... That SSH connection works absolutely fine but VScode fails everytime.

Here is the trace that i get...

[12:20:57.993] Log Level: 2
[12:20:57.994] remote-ssh@0.73.2022020915
[12:20:57.994] win32 x64
[12:20:57.998] SSH Resolver called for "ssh-remote+192.168.29.92", attempt 1
[12:20:57.999] "remote.SSH.useLocalServer": false
[12:20:57.999] "remote.SSH.showLoginTerminal": false
[12:20:57.999] "remote.SSH.remotePlatform": {"35.238.31.171":"linux","Debian":"linux","gcp":"linux","debian":"linux","192.168.29.92":"windows"}
[12:20:57.999] "remote.SSH.path": C:\Windows\System32\OpenSSH\ssh.exe
[12:20:57.999] "remote.SSH.configFile": undefined
[12:20:58.000] "remote.SSH.useFlock": true
[12:20:58.000] "remote.SSH.lockfilesInTmp": true
[12:20:58.000] "remote.SSH.localServerDownload": always
[12:20:58.000] "remote.SSH.remoteServerListenOnSocket": false
[12:20:58.000] "remote.SSH.showLoginTerminal": false
[12:20:58.000] "remote.SSH.defaultExtensions": []
[12:20:58.000] "remote.SSH.loglevel": 2
[12:20:58.001] "remote.SSH.enableDynamicForwarding": true
[12:20:58.001] "remote.SSH.enableRemoteCommand": true
[12:20:58.001] "remote.SSH.serverPickPortsFromRange": {}
[12:20:58.001] "remote.SSH.serverInstallPath": {}
[12:20:58.026] SSH Resolver called for host: 192.168.29.92
[12:20:58.026] Setting up SSH remote "192.168.29.92"
[12:20:58.031] Using commit id "d6ee99e4c045a6716e5c653d7da8e9ae6f5a8b03" and quality "stable" for server
[12:20:58.034] Install and start server if needed
[12:20:58.036] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[12:20:58.061] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[12:20:58.063] Remote command length: 6157/8192 characters
[12:20:58.064] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 49786 "192.168.29.92" powershell
[12:20:58.066] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[12:20:58.277] > �]0;C:\WINDOWS\System32\cmd.exe�
[12:20:58.277] Got some output, clearing connection timeout
[12:21:01.044] > 80874133@cwwpvt@192.168.29.92's password:
[12:21:01.044] Showing password prompt
[12:21:09.602] Got password response
[12:21:09.603] "install" wrote data to terminal: "***********"
[12:21:09.621] >
[12:21:14.169] > Windows PowerShell

Copyright (C) Microsoft Corporation. All rights reserved.Try the new cross-platform PowerShell https://aka.ms/pscore6
[12:21:14.188] >
[12:21:14.349] > PS C:\Users\80874133>
[12:21:14.532] >
[12:21:14.550] > PS C:\Users\80874133> $uuid="386f53220e86"
[12:21:14.565] > PS C:\Users\80874133> "${uuid}: running"
386f53220e86: running
PS C:\Users\80874133> "386f53220e86: pauseLog
[12:21:15.504] > PS C:\Users\80874133> main
[12:21:15.514] >
[12:21:21.747] > gcim : Access denied
At line:4 char:6

$u_=(gcim win32_process | ? processid -eq $t_).parentprocessid
 ~~~~~~~~~~~~~~~~~~
CategoryInfo : PermissionDenied: (root\cimv2:win32_process:String
g) [Get-CimInstance], CimException
FullyQualifiedErrorId : HRESULT 0x80041003,Microsoft.Management.Infrastruc
cture.CimCmdlets.GetCimInstanceCommand
no sshd parent proc
[12:21:21.755] >
[12:21:23.054] "install" terminal command done
[12:21:23.055] Install terminal quit with output: no sshd parent proc
[12:21:23.055] Received install output: no sshd parent proc
[12:21:23.056] Failed to parse remote port from server output
[12:21:23.056] Resolver error: Error:
at Function.Create (c:\Users\kocha.vscode\extensions\ms-vscode-remote.remote-ssh-0.73.2022020915\out\extension.js:1:585917)
at Object.t.handleInstallOutput (c:\Users\kocha.vscode\extensions\ms-vscode-remote.remote-ssh-0.73.2022020915\out\extension.js:1:584569)
at Object.t.tryInstall (c:\Users\kocha.vscode\extensions\ms-vscode-remote.remote-ssh-0.73.2022020915\out\extension.js:1:680433)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async c:\Users\kocha.vscode\extensions\ms-vscode-remote.remote-ssh-0.73.2022020915\out\extension.js:1:643292
at async Object.t.withShowDetailsEvent (c:\Users\kocha.vscode\extensions\ms-vscode-remote.remote-ssh-0.73.2022020915\out\extension.js:1:646637)
at async Object.t.resolve (c:\Users\kocha.vscode\extensions\ms-vscode-remote.remote-ssh-0.73.2022020915\out\extension.js:1:644371)
at async c:\Users\kocha.vscode\extensions\ms-vscode-remote.remote-ssh-0.73.2022020915\out\extension.js:1:721387
[12:21:23.060] ------

I looks duplicate of #2648 but that, unfortunately, hasn't helped me much.... I am out of options and it is important for this to work for me.

Thank you.

@github-actions github-actions bot added the ssh Issue in vscode-remote SSH label Feb 15, 2022
@tanhakabir
Copy link

Which version of VS Code are you using?

@vsheg
Copy link

vsheg commented Feb 16, 2022

I also have problem with VS Code via SSH. Yesterday everything worked fine

  • my mac: 1.64.2, commit: f80445acd5a3dadef24aa209168452a3d97cc326
  • remote machine: 1.64.2, commit: f80445acd5a3dadef24aa209168452a3d97cc326 x64

When I try to connect, I see: 'Installing VS Code server' and it ends with an error.

Output
<a lot of text>

Written by John Gilmore and Jay Fenlason.
tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
do_install:8: command not found: elapsed
ERROR: tar exited with non-0 exit code: 0
do_client_download_or_fail:8: command not found: fail_with_exitcode
bc122fc4ec21%%2%%
tar --version:
do_install:1: command not found: millis
tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
do_install:8: command not found: elapsed
ERROR: tar exited with non-0 exit code: 0
do_client_download_or_fail:8: command not found: fail_with_exitcode
bc122fc4ec21%%2%%
tar --version:
do_install:1: command not found: millis
tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
ERROR: tar exited with non-0 exit code: 0
do_install:8: command not found: elapsed
do_client_download_or_fail:8: command not found: fail_with_exitcode
bc122fc4ec21%%2%%
tar --version:
do_install:1: command not found: millis
tar (GNU tar) 1.34
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
tar: This does not look like a tar archive

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now
do_install:8: command not found: elapsed
do_client_download_or_fail:14: maximum nested function level reached; increase FUNCNEST?
ERROR: tar exited with non-0 exit code: 0
Transferred: sent 18812, received 464488 bytes, in 2.4 seconds
Bytes per second: sent 7874.6, received 194431.2
local-server-1> ssh child died, shutting down

[08:41:12.156] Failed to parse remote port from server output
[08:41:12.159] Resolver error: Error: 
	at Function.Create (/Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:585917)
	at Object.t.handleInstallOutput (/Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:584569)
	at Object.e [as tryInstallWithLocalServer] (/Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:624925)
	at runMicrotasks (<anonymous>)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async /Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:643015
	at async Object.t.withShowDetailsEvent (/Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:646762)
	at async /Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:623397
	at async b (/Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:619903)
	at async Object.t.resolveWithLocalServer (/Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:623012)
	at async Object.t.resolve (/Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:644372)
	at async /Users/sheg/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/extension.js:1:721503
[08:41:12.162] ------

@kochargs
Copy link
Author

kochargs commented Feb 16, 2022

Which version of VS Code are you using?

source machine windows 11

Version: 1.64.2 (user setup)
Commit: f80445acd5a3dadef24aa209168452a3d97cc326
Date: 2022-02-09T22:02:28.252Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

@tanhakabir

@shiltian
Copy link

shiltian commented Feb 16, 2022

I encountered same issue as well.

[11:15:20.558] Log Level: 2
[11:15:20.560] remote-ssh@0.75.2022021615
[11:15:20.560] darwin x64
[11:15:20.571] SSH Resolver called for "ssh-remote+exxact-f1", attempt 1
[11:15:20.572] "remote.SSH.useLocalServer": true
[11:15:20.572] "remote.SSH.path": undefined
[11:15:20.573] "remote.SSH.configFile": undefined
[11:15:20.573] "remote.SSH.useFlock": true
[11:15:20.573] "remote.SSH.lockfilesInTmp": false
[11:15:20.574] "remote.SSH.localServerDownload": auto
[11:15:20.574] "remote.SSH.remoteServerListenOnSocket": false
[11:15:20.574] "remote.SSH.showLoginTerminal": false
[11:15:20.574] "remote.SSH.defaultExtensions": []
[11:15:20.574] "remote.SSH.loglevel": 2
[11:15:20.574] "remote.SSH.enableDynamicForwarding": true
[11:15:20.577] "remote.SSH.enableRemoteCommand": false
[11:15:20.578] "remote.SSH.serverPickPortsFromRange": {}
[11:15:20.578] "remote.SSH.serverInstallPath": {}
[11:15:20.589] SSH Resolver called for host: exxact-f1
[11:15:20.589] Setting up SSH remote "exxact-f1"
[11:15:20.593] Acquiring local install lock: /var/folders/7z/ty6dp3v12_vbqpp6zqg9qmkw0000gn/T/vscode-remote-ssh-b02dfd6a-install.lock
[11:15:20.597] Looking for existing server data file at /Users/shiltian/Library/Application Support/Code - Insiders/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-b02dfd6a-52e65499654de7525e30df3a8228b69320796bf5-0.75.2022021615/data.json
[11:15:20.598] Using commit id "52e65499654de7525e30df3a8228b69320796bf5" and quality "insider" for server
[11:15:20.601] Install and start server if needed
[11:15:20.605] PATH: /usr/local/sbin:/Users/shiltian/Library/Python/3.9/bin:/Users/shiltian/Applications/arcanist/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/Library/Apple/usr/bin:/Users/shiltian/.cargo/bin
[11:15:20.605] Checking ssh with "ssh -V"
[11:15:20.610] > OpenSSH_8.6p1, LibreSSL 2.8.3

[11:15:20.614] askpass server listening on /var/folders/7z/ty6dp3v12_vbqpp6zqg9qmkw0000gn/T/vscode-ssh-askpass-b85802aef2c2d2f6f39aaf13cafad75eac967514.sock
[11:15:20.615] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/7z/ty6dp3v12_vbqpp6zqg9qmkw0000gn/T/vscode-ssh-askpass-99b6822ff4420a3a902df87961e84a019d0c31fe.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","50227","-o","ConnectTimeout=15","exxact-f1"],"serverDataFolderName":".vscode-server-insiders","dataFilePath":"/Users/shiltian/Library/Application Support/Code - Insiders/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-b02dfd6a-52e65499654de7525e30df3a8228b69320796bf5-0.75.2022021615/data.json"}
[11:15:20.615] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/shiltian/.vscode-insiders/extensions/ms-vscode-remote.remote-ssh-0.75.2022021615/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/Users/shiltian/.vscode-insiders/extensions/ms-vscode-remote.remote-ssh-0.75.2022021615/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/7z/ty6dp3v12_vbqpp6zqg9qmkw0000gn/T/vscode-ssh-askpass-b85802aef2c2d2f6f39aaf13cafad75eac967514.sock"}
[11:15:20.617] Spawned 48525
[11:15:20.738] > local-server-1> Spawned ssh, pid=48531
[11:15:20.740] stderr> OpenSSH_8.6p1, LibreSSL 2.8.3
[11:15:20.785] stderr> debug1: Server host key: ssh-ed25519 SHA256:wD6S3jupjWe7T4bK7gsO0pSAu0k+pjPRRJ/PHdQiUnc
[11:15:20.850] stderr> Authenticated to <hide> (<hide>:22).
[11:15:21.286] > ready: 258185b16225
[11:15:21.288] > Linux 5.11.12-300.fc34.x86_64 #1 SMP Wed Apr 7 16:31:13 UTC 2021
[11:15:21.289] Platform: linux
[11:15:24.294] stderr> bash: line 3: syntax error near unexpected token `fi'
[11:15:24.294] stderr> bash: line 3: `		fi'
[11:15:24.297] stderr> zsh: parse error near `}'
[11:15:24.298] > Installing to ...
[11:15:24.300] > 258185b16225%%1%%
[11:15:24.311] > Downloading with wget
[11:15:24.808] > wget download failed
> https://update.code.visualstudio.com/commit:/server-darwin/insider:
> 2022-02-16 11:15:24 ERROR 404: Not Found.
[11:15:24.814] > 258185b16225%%2%%
> tar --version:
[11:15:24.817] > tar (GNU tar) 1.34
> Copyright (C) 2021 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by John Gilmore and Jay Fenlason.
[11:15:24.820] stderr> tar: This does not look like a tar archive
[11:15:24.822] stderr> 
[11:15:24.822] stderr> gzip: stdin: unexpected end of file
[11:15:24.822] stderr> tar: Child returned status 1
[11:15:24.822] stderr> tar: Error is not recoverable: exiting now
[11:15:24.825] > ERROR: tar exited with non-0 exit code: 0
[11:15:24.829] > 258185b16225%%2%%
> tar --version:
[11:15:24.832] > tar (GNU tar) 1.34
> Copyright (C) 2021 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
> This is free software: you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> Written by John Gilmore and Jay Fenlason.
[11:15:24.835] stderr> tar: This does not look like a tar archive
[11:15:24.837] stderr> 
[11:15:24.837] stderr> gzip: stdin: unexpected end of file
[11:15:24.837] stderr> tar: Child returned status 1
[11:15:24.837] stderr> tar: Error is not recoverable: exiting now
[11:15:24.839] > ERROR: tar exited with non-0 exit code: 0
[11:15:24.844] > 258185b16225%%2%%
...

@tanhakabir
Copy link

tanhakabir commented Feb 16, 2022

@kochargs do you have admin permissions on the account you're SSH connecting to? Unfortunately we have the long standing issue of not being able to connect to non-admin Windows accounts which you had linked #2648

@vsheg and @shiltian your issues are different from @kochargs. Would both of you mind creating a separate issue?

@vsheg based on some of your logs it looks like you guys have an incomplete download that you're trying to unzip. Could you post the full log on your issue?

@shiltian what is the default shell of your remote? What happens if you set it to bash before connecting?

@shiltian
Copy link

@tanhakabir Thanks for the info. I created #6351 as well.

My default shell is zsh. It works w/o any issue if I change it back to bash. However, it didn't have any problem the day before yesterday.

@tanhakabir tanhakabir added the info-needed Issue requires more information from poster label Feb 16, 2022
@kochargs
Copy link
Author

@tanhakabir
This setup was working just perfectly until a week ago with the same credentials... same account permissions.
This is not an admin account but a user account. However, I can request admin permissions that last for 24 hours, and then it resets back to a non-admin account. I have tried to establish a session with VSCODE even when I am the admin of the account but it doesn't help either. A reboot generally resolves half of the world's problems when it stops working overnight but this time it didn't.

@tanhakabir
Copy link

@kochargs I'm not sure why it was working before but we need admin permissions because our set up script needs to run this: (gcim win32_process | ? processid -eq $PID).parentprocessid.Are you able to run this on your remote in the non-admin user?

@kochargs
Copy link
Author

kochargs commented Feb 21, 2022

@tanhakabir
it does seem to work from my user account ( the non admin user )

PS C:\Users\80874133> (gcim win32_process | ? processid -eq $PID).parentprocessid
13480

but I am still unable to connect via VSCode.
Are there any workarounds other than asking for an admin account to connect to which I am certain I won't get because this is how an organization setups the laptops for their employees? This is really disappointing that I am unable to use VSCode for remote work and it stopped all of sudden :(

Does it matter what my default shell on my remote windows machine is?

@tanhakabir
Copy link

@kochargs how are you running (gcim win32_process | ? processid -eq $PID).parentprocessid? Are you ssh connecting to the remote and then running it?

Not sure how else to help since VS Code is just unable to run this necessary command to connect. As seen in your first logs:

gcim : Access denied
At line:4 char:6

$u_=(gcim win32_process | ? processid -eq $t_).parentprocessid
 ~~~~~~~~~~~~~~~~~~
CategoryInfo : PermissionDenied: (root\cimv2:win32_process:String

@kochargs
Copy link
Author

@tanhakabir

This is interesting.

So if I SSH to the remote windows and then execute, it fails with this

PS C:\Users\80874133\Box\Network Automation> (gcim win32_process | ? processid -eq $PID).parentprocessid
gcim : Access denied
At line:1 char:2

  • (gcim win32_process | ? processid -eq $PID).parentprocessid
  •  + CategoryInfo          : PermissionDenied: (root\cimv2:win32_process:String) [Get-CimInstance], CimException
     + FullyQualifiedErrorId : HRESULT 0x80041003,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand
    
    

However I log in to the remote machine and run it from its Powershell, it works

PS C:\Users\80874133\Box\Network Automation> (gcim win32_process | ? processid -eq $PID).parentprocessid
14296

What does this indicate about the problem?

Thanks

@tanhakabir
Copy link

@kochargs I'm not fully sure but what I'm understanding is when you manually log into the remote machine the Powershell shell you're using seems to have admin permissions. But that same level of permission isn't given to SSH connections.

Are you using Powershell Administer?

@kochargs
Copy link
Author

I am using the default PowerShell that comes installed with windows.

@tanhakabir
Copy link

@kochargs I'm sorry I don't know more than that of what could be different now in your setup but until you can ssh into your windows machine and run that line of code, the VS Code extension can't work. We need admin permissions to run that line and historically we've seen issues with Windows accounts that aren't the admin accounts. Sorry we don't know more here :/

@kochargs
Copy link
Author

No problem.
Thanks a lot for your help and suggestions @tanhakabir
Although it does look like a privilege issue only via SSH not when I am directly executing the same command from the shell of the remote machine.

Since this remote machine is an organization-owned machine, I will now go and talk to the IT team to hopefully elevate some access level if they can.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster ssh Issue in vscode-remote SSH
Projects
None yet
Development

No branches or pull requests

4 participants