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.65k stars 285 forks source link

remote-ssh : Couldn't establish connection to localhost #8537

Closed vivek-kurma closed 1 year ago

vivek-kurma commented 1 year ago

Type: Bug

Extension: Remote-ssh v0.102.0

ssh config file: host: localhost port: 2345 user: vivann login through password

I am forwarding port 22 from my vm(VirtualBox Ubuntu 22.04) to local port 2345 to connect thru ssh. Normal ssh thru putty works fine. The vm has vscode installed.

Log Trace:

[10:59:42.285] Log Level: 1
[10:59:42.296] SSH Resolver called for "ssh-remote+localhost", attempt 1
[10:59:42.297] "remote.SSH.useLocalServer": false
[10:59:42.298] "remote.SSH.showLoginTerminal": true
[10:59:42.298] "remote.SSH.remotePlatform": {"kalinux":"linux","ns3start":"linux","ns-vm":"linux","ns3local":"linux"}
[10:59:42.298] "remote.SSH.path": undefined
[10:59:42.298] "remote.SSH.configFile": undefined
[10:59:42.299] "remote.SSH.useFlock": true
[10:59:42.299] "remote.SSH.lockfilesInTmp": false
[10:59:42.299] "remote.SSH.localServerDownload": auto
[10:59:42.299] "remote.SSH.remoteServerListenOnSocket": false
[10:59:42.300] "remote.SSH.showLoginTerminal": true
[10:59:42.300] "remote.SSH.defaultExtensions": []
[10:59:42.300] "remote.SSH.loglevel": 1
[10:59:42.300] "remote.SSH.enableDynamicForwarding": true
[10:59:42.301] "remote.SSH.enableRemoteCommand": true
[10:59:42.303] "remote.SSH.serverPickPortsFromRange": {}
[10:59:42.303] "remote.SSH.serverInstallPath": {}
[10:59:42.310] VS Code version: 1.78.2
[10:59:42.310] Remote-SSH version: remote-ssh@0.102.0
[10:59:42.310] win32 x64
[10:59:42.311] SSH Resolver called for host: localhost
[10:59:42.311] Setting up SSH remote "localhost"
[10:59:42.315] Using commit id "b3e4e68a0bc097f0ae7907b217c1119af9e03435" and quality "stable" for server
[10:59:42.319] Install and start server if needed
[10:59:47.120] Checking ssh with "D:\vivann\Programs\ImageMagick-7.1.0-Q16-HDRI\ssh.exe -V"
[10:59:47.123] Got error from ssh: spawn D:\vivann\Programs\ImageMagick-7.1.0-Q16-HDRI\ssh.exe ENOENT
[10:59:47.123] Checking ssh with "D:\vivann\Programs\jdk 17.0.4\bin\ssh.exe -V"
[10:59:47.125] Got error from ssh: spawn D:\vivann\Programs\jdk 17.0.4\bin\ssh.exe ENOENT
[10:59:47.125] Checking ssh with "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe -V"
[10:59:47.127] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe ENOENT
[10:59:47.127] Checking ssh with "D:\vivann\Programs\oracleDB\bin\ssh.exe -V"
[10:59:47.129] Got error from ssh: spawn D:\vivann\Programs\oracleDB\bin\ssh.exe ENOENT
[10:59:47.129] Checking ssh with "C:\Program Files\Common Files\Oracle\Java\javapath\ssh.exe -V"
[10:59:47.131] Got error from ssh: spawn C:\Program Files\Common Files\Oracle\Java\javapath\ssh.exe ENOENT
[10:59:47.131] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[10:59:47.133] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[10:59:47.133] Checking ssh with "C:\Windows\ssh.exe -V"
[10:59:47.135] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[10:59:47.137] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[10:59:47.139] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[10:59:47.139] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[10:59:47.142] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[10:59:47.142] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[10:59:47.180] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[10:59:47.185] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 62057 localhost bash
[10:59:47.189] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[10:59:47.572] "install" terminal received data: "The system cannot find the path specified.
]0;C:\WINDOWS\System32\cmd.exe[?25h"
[10:59:47.572] Got some output, clearing connection timeout
[10:59:47.578] "install" terminal received data: "The system cannot find the path specified.











[?25h"
[10:59:49.655] "install" terminal received data: "vivann@localhost's password: "
[10:59:51.031] "install" terminal received data: ""
[10:59:52.511] "install" terminal command done
[10:59:52.512] Install terminal quit with output: vivann@localhost's password: 
[10:59:52.512] Received install output: vivann@localhost's password: 
[10:59:52.512] Stopped parsing output early. Remaining text: vivann@localhost's password:
[10:59:52.512] Failed to parse remote port from server output
[10:59:52.514] Resolver error: Error: 
    at m.Create (c:\Users\vivann\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:584145)
    at t.handleInstallOutput (c:\Users\vivann\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:582705)
    at t.tryInstall (c:\Users\vivann\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:681881)
    at async c:\Users\vivann\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:644110
    at async t.withShowDetailsEvent (c:\Users\vivann\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:647428)
    at async t.resolve (c:\Users\vivann\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:645160)
    at async c:\Users\vivann\.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:720916
[10:59:52.517] TELEMETRY: {"eventName":"resolver","properties":{"osReleaseId":"","arch":"","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"1","localServer":"0","didLocalDownload":"0","installUnpackCode":"0","outcome":"failure","reason":"UnparsableOutput","exitCodeLabel":""},"measures":{"resolveAttempts":1,"timing.totalResolveTime":10217,"timing.preSshTime":4892,"timing.scriptTime":5324}}
[10:59:52.520] ------

Extension version: 0.102.0 VS Code version: Code 1.78.2 (b3e4e68a0bc097f0ae7907b217c1119af9e03435, 2023-05-10T14:39:26.248Z) OS version: Windows_NT x64 10.0.19045 Modes: Sandboxed: Yes

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz (12 x 2592)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|15.77GB (4.46GB free)| |Process Argv|--crash-reporter-id 3d725c28-ef58-4d99-a690-a1bafdf667d7| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383cf:30185419 vspor879:30202332 vspor708:30202333 vspor363:30204092 vstes627:30244334 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vshan820:30294714 vstes263cf:30335440 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 cmake_vspar411:30581797 vsaa593:30376534 pythonvs932:30410667 cppdebug:30492333 vsclangdf:30486550 c4g48928:30535728 dsvsc012cf:30540253 pynewext54:30695312 azure-dev_surveyone:30548225 3biah626:30602489 pyind779:30671433 f6dab269:30613381 pythonsymbol12:30671437 showlangstatbar:30737416 vsctsb:30748421 pythonms35:30701012 pythonfmttext:30731395 fixhidewlkth:30730051 pythongtdpathcf:30739705 ```
roblourens commented 1 year ago

Does anything in https://github.com/microsoft/vscode-remote-release/wiki/Debugging-for-Remote-SSH help?

hahia commented 1 year ago

I also had this problem, when tring to connect to localhost. `[11:04:38.892] Log Level: 2 [11:04:38.903] SSH Resolver called for "ssh-remote+sp", attempt 1 [11:04:38.904] "remote.SSH.useLocalServer": false [11:04:38.904] "remote.SSH.showLoginTerminal": true [11:04:38.904] "remote.SSH.remotePlatform": {"sm2":"linux","192.168.61.6":"linux","sm1":"linux","c14":"linux","ztron":"linux","sp":"linux"} [11:04:38.904] "remote.SSH.path": C:\Program Files\OpenSSH-Win64\ssh.exe [11:04:38.904] "remote.SSH.configFile": C:\Users\huanghuaqiang.ssh\config [11:04:38.904] "remote.SSH.useFlock": false [11:04:38.904] "remote.SSH.lockfilesInTmp": false [11:04:38.905] "remote.SSH.localServerDownload": auto [11:04:38.905] "remote.SSH.remoteServerListenOnSocket": false [11:04:38.905] "remote.SSH.showLoginTerminal": true [11:04:38.905] "remote.SSH.defaultExtensions": [] [11:04:38.905] "remote.SSH.loglevel": 2 [11:04:38.905] "remote.SSH.enableDynamicForwarding": false [11:04:38.905] "remote.SSH.enableRemoteCommand": false [11:04:38.906] "remote.SSH.serverPickPortsFromRange": {} [11:04:38.906] "remote.SSH.serverInstallPath": {} [11:04:38.912] VS Code version: 1.78.2 [11:04:38.912] Remote-SSH version: remote-ssh@0.102.0 [11:04:38.912] win32 x64 [11:04:38.913] SSH Resolver called for host: sp [11:04:38.913] Setting up SSH remote "sp" [11:04:38.915] Using commit id "b3e4e68a0bc097f0ae7907b217c1119af9e03435" and quality "stable" for server [11:04:38.918] Install and start server if needed [11:04:38.920] Checking ssh with "C:\Program Files\OpenSSH-Win64\ssh.exe -V" [11:04:38.960] > OpenSSH_for_Windows_8.9p1, LibreSSL 3.4.3

[11:04:38.964] Using SSH config file "C:\Users\huanghuaqiang.ssh\config" [11:04:38.964] Running script with connection command: "C:\Program Files\OpenSSH-Win64\ssh.exe" -T -o ClearAllForwardings=true -F "C:\Users\huanghuaqiang.ssh\config" sp bash [11:04:38.967] Terminal shell path: C:\Windows\System32\cmd.exe [11:04:39.393] > ]0;C:\Windows\System32\cmd.exe [11:04:39.393] Got some output, clearing connection timeout [11:04:39.412] >

[11:04:39.427] > kex_exchange_identification: read: Connection reset Connection reset by ::1 port 9999 过程试图写入的管道不存在。 [11:04:40.700] "install" terminal command done [11:04:40.700] Install terminal quit with output: 过程试图写入的管道不存在。 [11:04:40.700] Received install output: 过程试图写入的管道不存在。 [11:04:40.701] Failed to parse remote port from server output [11:04:40.702] Resolver error: Error: at m.Create (c:\Users\huanghuaqiang.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:584145) at t.handleInstallOutput (c:\Users\huanghuaqiang.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:582705) at t.tryInstall (c:\Users\huanghuaqiang.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:681881) at async c:\Users\huanghuaqiang.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:644110 at async t.withShowDetailsEvent (c:\Users\huanghuaqiang.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:647428) at async t.resolve (c:\Users\huanghuaqiang.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:645160) at async c:\Users\huanghuaqiang.vscode\extensions\ms-vscode-remote.remote-ssh-0.102.0\out\extension.js:1:720916 [11:04:40.707] ------`

roblourens commented 1 year ago

There is a different issue going on in yours, you got this error kex_exchange_identification: read: Connection reset, you can search around to find reasons why that error shows up, but it's not really easily identifiable.

hahia commented 1 year ago

thanks, I will try to search.

vivek-kurma commented 1 year ago

Does anything in https://github.com/microsoft/vscode-remote-release/wiki/Debugging-for-Remote-SSH help?

I tried changing the settings, but no result is different from the original one. here is the gist of the error:

"[10:59:13.478] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 50604 localhost bash [10:59:13.487] Terminal shell path: C:\WINDOWS\System32\cmd.exe [10:59:13.890] "install" terminal received data: "The system cannot find the path specified. ]0;C:\WINDOWS\System32\cmd.exe[?25h" [10:59:13.890] Got some output, clearing connection timeout [10:59:13.901] "install" terminal received data: "The system cannot find the path specified. [K           [?25"

The path to cmd.exe is correct and is present on the local machine(Windows 10). I found a similar issue : https://github.com/microsoft/vscode-remote-release/issues/1479

C:\WINDOWS\System32 is present on both System and User variables PATH

roblourens commented 1 year ago

Something must be really wrong with your system, sorry, I don't think I can help with it.

anonyme22 commented 1 year ago

I got similar issue; in my case look like the know fingerprint was not a match with the new one. So, I delete contenant from C:\Users\[Username here]/.ssh/known_hosts and restart SSH session

vivek-kurma commented 1 year ago

Fixed the bug by adding the correct open-ssh location "remote.SSH.path" in the settings.json