microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.69k stars 296 forks source link

SSH-Connection with PubkeyAuth fails #6776

Closed VenRoot closed 2 years ago

VenRoot commented 2 years ago

Does this issue occur when all extensions are disabled?: Needs SSH-Extension

Steps to Reproduce:

  1. Setup a PublicKeyAuthentication with your ssh server
  2. Try to connect to it in VS Code

I've setup Public-Key Authentication with my server and it works from the terminal. When trying to connect in VSCode, it connects but hangs for a bit, then throws a timeout

[11:12:57.259] Spawned 30607 [11:12:57.387] > local-server-1> Spawned ssh, pid=30615 [11:12:57.390] stderr> OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022 [11:12:57.412] stderr> debug1: Server host key: ssh-ed25519 SHA256:RL4vNF3CG4gP+VccGy/YHKlU5kl0ysyTWIxW2UURtxU [11:12:57.710] stderr> Authenticated to 192.168.178.3 ([192.168.178.3]:22) using "publickey". [11:12:57.801] > Linux Ven 5.10.102.1-microsoft-standard-WSL2 microsoft/vscode#1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64

The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. [11:13:14.261] Terminating local server [11:13:14.262] Resolver error: Error: Connecting with SSH timed out at Function.Timeout (/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022051915/out/extension.js:1:585915) at Timeout._onTimeout (/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022051915/out/extension.js:1:631027) at listOnTimeout (node:internal/timers:557:17) at processTimers (node:internal/timers:500:7) [11:13:14.272] ------

[11:13:14.273] Local server exit: 15

vscodenpa commented 2 years ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.67.2. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

VenRoot commented 2 years ago

Just upgraded to 1.67.2, Issue still occurs

tanhakabir commented 2 years ago

Could you share your full Remote SSH logs?

VenRoot commented 2 years ago

[2022-05-31 22:34:49.113] [exthost] [info] Extension host with pid 26988 started [2022-05-31 22:34:49.183] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft' [2022-05-31 22:34:49.196] [exthost] [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: true, activationEvent: '' [2022-05-31 22:34:49.198] [exthost] [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '', root cause: vscode.git [2022-05-31 22:34:49.200] [exthost] [info] ExtensionService#_doActivateExtension vscode.ipynb, startup: true, activationEvent: '' [2022-05-31 22:34:49.203] [exthost] [info] ExtensionService#_doActivateExtension alefragnani.project-manager, startup: true, activationEvent: '' [2022-05-31 22:34:49.221] [exthost] [info] ExtensionService#_doActivateExtension christian-kohler.path-intellisense, startup: true, activationEvent: '' [2022-05-31 22:34:49.229] [exthost] [info] ExtensionService#_doActivateExtension donjayamanne.githistory, startup: true, activationEvent: '' [2022-05-31 22:34:49.244] [exthost] [info] ExtensionService#_doActivateExtension ecmel.vscode-html-css, startup: true, activationEvent: '' [2022-05-31 22:34:49.269] [exthost] [info] ExtensionService#_doActivateExtension formulahendry.auto-rename-tag, startup: true, activationEvent: '' [2022-05-31 22:34:49.280] [exthost] [info] ExtensionService#_doActivateExtension GitHub.vscode-pull-request-github, startup: true, activationEvent: '' [2022-05-31 22:34:49.302] [exthost] [info] ExtensionService#_doActivateExtension icrawl.discord-vscode, startup: true, activationEvent: '' [2022-05-31 22:34:49.308] [exthost] [info] ExtensionService#_doActivateExtension mhutchie.git-graph, startup: true, activationEvent: '' [2022-05-31 22:34:49.329] [exthost] [info] ExtensionService#_doActivateExtension ms-mssql.data-workspace-vscode, startup: true, activationEvent: '' [2022-05-31 22:34:49.356] [exthost] [info] ExtensionService#_doActivateExtension oouo-diogo-perdigao.docthis, startup: true, activationEvent: '' [2022-05-31 22:34:49.419] [exthost] [info] ExtensionService#_doActivateExtension rcore.rcore-unused-css-classes, startup: true, activationEvent: '' [2022-05-31 22:34:49.419] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.live-server, startup: true, activationEvent: '', root cause: ryanluker.vscode-coverage-gutters [2022-05-31 22:34:49.428] [exthost] [info] ExtensionService#_doActivateExtension wayou.vscode-todo-highlight, startup: true, activationEvent: '' [2022-05-31 22:34:49.515] [exthost] [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '' [2022-05-31 22:34:49.530] [exthost] [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '' [2022-05-31 22:34:49.534] [exthost] [info] ExtensionService#_doActivateExtension ryanluker.vscode-coverage-gutters, startup: true, activationEvent: '' [2022-05-31 22:34:49.588] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.js-debug, startup: false, activationEvent: 'onCommand:extension.js-debug.setAutoAttachVariables' [2022-05-31 22:34:49.688] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github' [2022-05-31 22:34:49.884] [exthost] [info] Eager extensions activated [2022-05-31 22:34:49.892] [exthost] [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:49.897] [exthost] [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:49.899] [exthost] [info] ExtensionService#_doActivateExtension bradlc.vscode-tailwindcss, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:49.931] [exthost] [info] ExtensionService#_doActivateExtension dbaeumer.vscode-eslint, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:49.939] [exthost] [info] ExtensionService#_doActivateExtension dsznajder.es7-react-js-snippets, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.142] [exthost] [info] ExtensionService#_doActivateExtension eamodio.gitlens, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.175] [exthost] [info] ExtensionService#_doActivateExtension esbenp.prettier-vscode, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.226] [exthost] [info] ExtensionService#_doActivateExtension felipecaputo.git-project-manager, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.247] [exthost] [info] ExtensionService#_doActivateExtension formulahendry.code-runner, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.262] [exthost] [info] ExtensionService#_doActivateExtension GitHub.copilot, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.371] [exthost] [info] ExtensionService#_doActivateExtension hoovercj.vscode-power-mode, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.382] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.417] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.422] [exthost] [info] ExtensionService#_doActivateExtension PKief.material-icon-theme, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.431] [exthost] [info] ExtensionService#_doActivateExtension ritwickdey.LiveServer, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.515] [exthost] [info] ExtensionService#_doActivateExtension usernamehw.errorlens, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:50.516] [exthost] [info] ExtensionService#_doActivateExtension waderyan.gitblame, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:34:53.508] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-ssh, startup: false, activationEvent: 'onView:sshHosts' [2022-05-31 22:34:57.929] [exthost] [info] Extension host terminating: renderer closed the socket [2022-05-31 22:34:57.956] [exthost] [error] An error occurred when deactivating the extension 'ms-vscode.live-server': [2022-05-31 22:34:57.957] [exthost] [error] TypeError: Cannot read properties of undefined (reading 'close') at u.close (/home/ven/.vscode/extensions/ms-vscode.live-server-0.2.12/out/extension.js:1:61991) at d.closeServer (/home/ven/.vscode/extensions/ms-vscode.live-server-0.2.12/out/extension.js:1:66944) at f.dispose (/home/ven/.vscode/extensions/ms-vscode.live-server-0.2.12/out/extension.js:1:57051) at Object.e.deactivate (/home/ven/.vscode/extensions/ms-vscode.live-server-0.2.12/out/extension.js:1:428160) at m._deactivate (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:13083) at /usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:10642 at Array.map () at m._deactivateAll (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:10630) at m.terminate (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:88:11010) at m.terminate (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:92:620) at l (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:36401) at Socket. (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:34097) at Socket.emit (node:events:402:35) at Pipe. (node:net:687:12) [2022-05-31 22:34:57.960] [exthost] [info] Extension host with pid 26988 exiting with code 0 [2022-05-31 22:34:59.094] [exthost] [info] Extension host with pid 27035 started [2022-05-31 22:34:59.141] [exthost] [info] $resolveAuthority invoked for authority (ssh-remote) [2022-05-31 22:34:59.146] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-ssh, startup: false, activationEvent: 'onResolveRemoteAuthority:ssh-remote' [2022-05-31 22:35:28.058] [exthost] [info] ExtensionService#_doActivateExtension alefragnani.project-manager, startup: true, activationEvent: '' [2022-05-31 22:35:28.090] [exthost] [info] ExtensionService#_doActivateExtension formulahendry.auto-rename-tag, startup: true, activationEvent: '' [2022-05-31 22:35:28.104] [exthost] [info] ExtensionService#_doActivateExtension icrawl.discord-vscode, startup: true, activationEvent: '' [2022-05-31 22:35:28.116] [exthost] [info] ExtensionService#_doActivateExtension wayou.vscode-todo-highlight, startup: true, activationEvent: '*' [2022-05-31 22:35:28.167] [exthost] [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft' [2022-05-31 22:35:28.414] [exthost] [info] Eager extensions activated [2022-05-31 22:35:28.416] [exthost] [info] ExtensionService#_doActivateExtension dsznajder.es7-react-js-snippets, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:35:28.669] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-containers, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:35:28.704] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:35:28.719] [exthost] [info] ExtensionService#_doActivateExtension PKief.material-icon-theme, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:35:28.728] [exthost] [info] ExtensionService#_doActivateExtension usernamehw.errorlens, startup: false, activationEvent: 'onStartupFinished' [2022-05-31 22:35:29.181] [exthost] [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'

This good?

tanhakabir commented 2 years ago

Thanks but I actually meant the top half of these logs:

[11:12:57.259] Spawned 30607
[11:12:57.387] > local-server-1> Spawned ssh, pid=30615
[11:12:57.390] stderr> OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022
[11:12:57.412] stderr> debug1: Server host key: ssh-ed25519 SHA256:RL4vNF3CG4gP+VccGy/YHKlU5kl0ysyTWIxW2UURtxU
[11:12:57.710] stderr> Authenticated to 192.168.178.3 ([192.168.178.3]:22) using "publickey".
[11:12:57.801] > Linux Ven 5.10.102.1-microsoft-standard-WSL2 https://github.com/microsoft/vscode/issues/1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[11:13:14.261] Terminating local server
[11:13:14.262] Resolver error: Error: Connecting with SSH timed out
at Function.Timeout (/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022051915/out/extension.js:1:585915)
at Timeout._onTimeout (/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022051915/out/extension.js:1:631027)
at listOnTimeout (node:internal/timers:557:17)
at processTimers (node:internal/timers:500:7)
[11:13:14.272] ------

[11:13:14.273] Local server exit: 15
VenRoot commented 2 years ago

Ah, thanks.

Here!

[23:40:15.353] Log Level: 2
[23:40:15.355] remote-ssh@0.81.2022052415
[23:40:15.356] linux x64
[23:40:15.361] SSH Resolver called for "ssh-remote+192.168.178.3", attempt 1
[23:40:15.364] "remote.SSH.useLocalServer": true
[23:40:15.365] "remote.SSH.path": undefined
[23:40:15.365] "remote.SSH.configFile": undefined
[23:40:15.366] "remote.SSH.useFlock": true
[23:40:15.366] "remote.SSH.lockfilesInTmp": false
[23:40:15.366] "remote.SSH.localServerDownload": auto
[23:40:15.367] "remote.SSH.remoteServerListenOnSocket": false
[23:40:15.367] "remote.SSH.showLoginTerminal": false
[23:40:15.368] "remote.SSH.defaultExtensions": []
[23:40:15.368] "remote.SSH.loglevel": 2
[23:40:15.368] "remote.SSH.enableDynamicForwarding": true
[23:40:15.369] "remote.SSH.enableRemoteCommand": false
[23:40:15.369] "remote.SSH.serverPickPortsFromRange": {}
[23:40:15.370] "remote.SSH.serverInstallPath": {}
[23:40:15.385] SSH Resolver called for host: 192.168.178.3
[23:40:15.385] Setting up SSH remote "192.168.178.3"
[23:40:15.388] Acquiring local install lock: /tmp/vscode-remote-ssh-4d277d69-install.lock
[23:40:15.390] Looking for existing server data file at /home/ven/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-4d277d69-c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5-0.81.2022052415/data.json
[23:40:15.391] Using commit id "c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5" and quality "stable" for server
[23:40:15.396] Install and start server if needed
[23:40:15.410] PATH: /home/ven/.local/bin:/home/ven/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/local/cuda/bin:/home/ven/.dotnet/tools:/usr/local/cuda/bin:/home/ven/.dotnet/tools
[23:40:15.410] Checking ssh with "ssh -V"
[23:40:15.418] > OpenSSH_8.9p1 Ubuntu-3, OpenSSL 3.0.2 15 Mar 2022

[23:40:15.421] askpass server listening on /run/user/1000/vscode-ssh-askpass-61e28dd03e5a2b33353e2fa581a91a21972d5f8c.sock
[23:40:15.421] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-d30f36c55860760a3be7a583b3dbf2ebedefd11c.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","41203","-o","ConnectTimeout=15","192.168.178.3"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/ven/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-4d277d69-c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5-0.81.2022052415/data.json"}
[23:40:15.422] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022052415/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022052415/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-61e28dd03e5a2b33353e2fa581a91a21972d5f8c.sock"}
[23:40:15.426] Spawned 33743
tanhakabir commented 2 years ago

Is there anything past:

[23:40:15.421] askpass server listening on /run/user/1000/vscode-ssh-askpass-61e28dd03e5a2b33353e2fa581a91a21972d5f8c.sock
[23:40:15.421] Spawning local server with {"serverId":1,"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-d30f36c55860760a3be7a583b3dbf2ebedefd11c.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","41203","-o","ConnectTimeout=15","192.168.178.3"],"serverDataFolderName":".vscode-server","dataFilePath":"/home/ven/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-4d277d69-c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5-0.81.2022052415/data.json"}
[23:40:15.422] Local server env: {"SSH_AUTH_SOCK":"/run/user/1000/keyring/ssh","SHELL":"/bin/bash","DISPLAY":":1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022052415/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/usr/share/code/code","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/home/ven/.vscode/extensions/ms-vscode-remote.remote-ssh-0.81.2022052415/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-61e28dd03e5a2b33353e2fa581a91a21972d5f8c.sock"}
[23:40:15.426] Spawned 33743

I don't see any exit or error messages like you had in your original post

VenRoot commented 2 years ago

Yes, sorry, the post above is what comes after the Spawned message. 1-Remote - SSH.log

I set the log level to trace and uploaded the entire log file. I really hope this helps you

I heard that setting remote.SSH.useLocalServer to false would solve the issue, but that seems to even work less.

...

After a few minutes I could resolve the issue:

"remote.SSH.showLoginTerminal": true

did it for me. Now everything is working 1-Remote - SSH.log Here is the log after the successful login.

Thank you for your help!

tanhakabir commented 2 years ago

Sorry about this but I'm glad you got it resolved!