vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

VS Code Remote SSH hangs if trying to connect through WSL SSH agent

Open jfgauron opened this issue 4 years ago • 6 comments

  • VSCode Version: 1.64.2
  • Local OS Version: Windows 11 Pro
  • Remote OS Version: Ubuntu 20.04
  • Remote Extension/Connection Type: SSH
  • Logs:
[10:59:38.246] Log Level: 2
[10:59:38.248] [email protected]
[10:59:38.248] win32 x64
[10:59:38.249] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a223137382e3132382e3232342e3433222c2275736572223a22726f6f74227d", attempt 1
[10:59:38.250] "remote.SSH.useLocalServer": false
[10:59:38.250] "remote.SSH.showLoginTerminal": false
[10:59:38.250] "remote.SSH.remotePlatform": {}
[10:59:38.250] "remote.SSH.path": undefined
[10:59:38.250] "remote.SSH.configFile": undefined
[10:59:38.251] "remote.SSH.useFlock": true
[10:59:38.251] "remote.SSH.lockfilesInTmp": false
[10:59:38.251] "remote.SSH.localServerDownload": auto
[10:59:38.251] "remote.SSH.remoteServerListenOnSocket": false
[10:59:38.251] "remote.SSH.showLoginTerminal": false
[10:59:38.251] "remote.SSH.defaultExtensions": []
[10:59:38.251] "remote.SSH.loglevel": 2
[10:59:38.251] "remote.SSH.serverPickPortsFromRange": {}
[10:59:38.252] "remote.SSH.enableDynamicForwarding": true
[10:59:38.252] "remote.SSH.serverInstallPath": {}
[10:59:38.252] SSH Resolver called for host: [email protected]
[10:59:38.252] Setting up SSH remote "178.128.224.43"
[10:59:38.267] Using commit id "f80445acd5a3dadef24aa209168452a3d97cc326" and quality "stable" for server
[10:59:38.270] Install and start server if needed
[10:59:39.738] Checking ssh with "ssh -V"
[10:59:39.760] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[10:59:39.764] Running script with connection command: ssh -T -D 52530 "[email protected]" bash
[10:59:39.766] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[10:59:39.979] > ]0;C:\WINDOWS\System32\cmd.exe
[10:59:39.979] Got some output, clearing connection timeout
[10:59:39.991] > C:\Users\jfgauron>C:\Windows\system32\wsl.exe ssh -T -D 52530 "[email protected]" bash 
[10:59:40.259] > Enter passphrase for key '/home/jfgauron/.ssh/id_rsa': 
[10:59:40.259] Detected passphrase message
[10:59:46.203] Got passphrase response
[10:59:46.203] "install" wrote data to terminal: "*******************"
[10:59:48.495] > 
> C:\Users\jfgauron>C:\Windows\system32\wsl.exe ssh -T -D 52530 "[email protected]" bash
> Enter passphrase for key '/home/jfgauron/.ssh/id_rsa':
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
[10:59:48.495] Detected passphrase message
[10:59:57.849] Got passphrase response
[10:59:57.849] "install" wrote data to terminal: "*******************"
[11:00:00.563] > 
> C:\Users\jfgauron>C:\Windows\system32\wsl.exe ssh -T -D 52530 "[email protected]" bash
> Enter passphrase for key '/home/jfgauron/.ssh/id_rsa':
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
[11:00:00.564] Detected passphrase message
[11:00:07.329] Got passphrase response
[11:00:07.330] "install" wrote data to terminal: "*******************"
[11:00:09.429] > 
> C:\Users\jfgauron>C:\Windows\system32\wsl.exe ssh -T -D 52530 "[email protected]" bash
> Enter passphrase for key '/home/jfgauron/.ssh/id_rsa':
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
[11:00:09.429] Detected passphrase message

Steps to Reproduce:

  1. Open VScode with Remote - SSH extension installed
  2. Press F1
  3. Select Remote-SSH: Connect to host...
  4. Select desired host. In my case it's [email protected]
  5. Select Linux
  6. Enter passphrase for ssh key

After those steps, I can get stuck at Setting up SSH Host 178.128.224.43: (details) Initializing VS.... If I press details, I get re-prompted to enter my passphrase but nothing happens. Looking at the logs output, nothing happens after "install" wrote data to terminal: "*******************".

I attached a video to show the issue:

https://user-images.githubusercontent.com/22077636/153719426-73a78546-172e-45ae-a193-4d7a7111b663.mp4

Does this issue occur when you try this locally?: No Does this issue occur when you try this locally and all extensions are disabled?: No

jfgauron avatar Feb 12 '22 16:02 jfgauron

Something I have noticed is that the behaviour is the same if I enter an incorrect passphrase as when I enter the correct one. And before someone ask, yes I made sure that my passphrase was correct by copy/pasting it locally and at the vscode prompt.

Could the fact that my passphrase contains special characters (a ! to be more precise) cause the issue?

jfgauron avatar Feb 12 '22 16:02 jfgauron

I can't repro this, but there is something funky going on with the terminal @Tyriar

It almost looks like sendText did not work. Does it work if you type your passphrase directly into that terminal (that opens when you click (details) in the progress notification?

Does it work if you set "remote.SSH.useLocalServer": true?

roblourens avatar Feb 16 '22 20:02 roblourens

Hi, no sorry same result with "remote.SSH.useLocalServer": true

jfgauron avatar Feb 18 '22 15:02 jfgauron

I'm able to reproduce this. Is VSCode expecting a terminal prompt? In particular, when the password is entered I do not receive a terminal prompt. I'm able to manually confirm that after entering the password that the terminal correctly responds though.

PS C:\Users\Kevin> C:\Windows\system32\wsl.exe ssh -T -D 57387 "kevin@********" bash
kevin@********'s password:
whoami
kevin

If I push Ctrl+C in the terminal window with the password prompt, it prompts me to terminate the ssh connection so I think sendText is working?

kevmo314 avatar Apr 18 '22 13:04 kevmo314

Ah, I've figured it out. This happens if you use this workaround: https://stackoverflow.com/questions/60150466/can-i-ssh-from-wsl-in-visual-studio-code

The ssh agent in wsl can't be used. :(

kevmo314 avatar Apr 19 '22 03:04 kevmo314

Let me know if this is still an issue

roblourens avatar Dec 17 '22 05:12 roblourens