VS Code Remote SSH Connection not working - "Could not establish connection to Harper"

546 views Asked by At

In the past I was able to connect with Remote-SSH without a problem but today, I wasn't able to connect. However, I can still connect to the remote server using ssh in the terminal... just not with remote-ssh on VSCode annymore. Currently my log is the below after my attempts at fixing it.

Connecting from Windows 11 (local machine) > Ubuntu 20 (remote machine) This problem is also replicable on other machines Ubuntu 22 (local machine) > Ubuntu 20 (remote machine)

[19:50:43.743] Log Level: 2
[19:50:43.858] VS Code version: 1.83.0
[19:50:43.858] Remote-SSH version: [email protected]
[19:50:43.858] win32 x64
[19:50:43.862] SSH Resolver called for "ssh-remote+harper", attempt 1
[19:50:43.862] "remote.SSH.useLocalServer": true
[19:50:43.862] "remote.SSH.useExecServer": false
[19:50:43.863] "remote.SSH.path": undefined
[19:50:43.863] "remote.SSH.configFile": undefined
[19:50:43.863] "remote.SSH.useFlock": true
[19:50:43.863] "remote.SSH.lockfilesInTmp": false
[19:50:43.863] "remote.SSH.localServerDownload": auto
[19:50:43.863] "remote.SSH.remoteServerListenOnSocket": false
[19:50:43.863] "remote.SSH.showLoginTerminal": false
[19:50:43.863] "remote.SSH.defaultExtensions": []
[19:50:43.864] "remote.SSH.loglevel": 2
[19:50:43.864] "remote.SSH.enableDynamicForwarding": true
[19:50:43.864] "remote.SSH.enableRemoteCommand": false
[19:50:43.864] "remote.SSH.serverPickPortsFromRange": {}
[19:50:43.865] "remote.SSH.serverInstallPath": {}
[19:50:43.876] SSH Resolver called for host: harper
[19:50:43.876] Setting up SSH remote "harper"
[19:50:43.881] Acquiring local install lock: C:\Users\Alex\AppData\Local\Temp\vscode-remote-ssh-aeb7b157-install.lock
[19:50:43.882] Looking for existing server data file at c:\Users\Alex\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-ssh\vscode-ssh-host-aeb7b157-e7e037083ff4455cf320e344325dacb480062c3c-0.106.5-tr\data.json
[19:50:43.883] Using commit id "e7e037083ff4455cf320e344325dacb480062c3c" and quality "stable" for server
[19:50:43.888] Install and start server if needed
[19:50:43.891] Checking ssh with "C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin\ssh.exe -V"
[19:50:43.894] Got error from ssh: spawn C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin\ssh.exe ENOENT
[19:50:43.894] Checking ssh with "C:\Program Files\PerkinElmerInformatics\ChemOffice\ChemScript\Lib\ssh.exe -V"
[19:50:43.896] Got error from ssh: spawn C:\Program Files\PerkinElmerInformatics\ChemOffice\ChemScript\Lib\ssh.exe ENOENT
[19:50:43.896] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[19:50:43.898] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[19:50:43.898] Checking ssh with "C:\Windows\ssh.exe -V"
[19:50:43.899] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[19:50:43.900] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[19:50:43.901] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[19:50:43.901] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[19:50:43.902] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[19:50:43.902] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[19:50:43.932] > OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3

[19:50:43.935] Checking ssh with "C:\Program Files\Python39\Scripts\ssh.exe -V"
[19:50:43.936] Got error from ssh: spawn C:\Program Files\Python39\Scripts\ssh.exe ENOENT
[19:50:43.936] Checking ssh with "C:\Users\Alex\AppData\Roaming\Python\Python39\Scripts\ssh.exe -V"
[19:50:43.937] Got error from ssh: spawn C:\Users\Alex\AppData\Roaming\Python\Python39\Scripts\ssh.exe ENOENT
[19:50:43.937] Checking ssh with "C:\Program Files\dotnet\ssh.exe -V"
[19:50:43.938] Got error from ssh: spawn C:\Program Files\dotnet\ssh.exe ENOENT
[19:50:43.938] Checking ssh with "C:\Users\Alex\AppData\Local\Microsoft\WindowsApps\ssh.exe -V"
[19:50:43.939] Got error from ssh: spawn C:\Users\Alex\AppData\Local\Microsoft\WindowsApps\ssh.exe ENOENT
[19:50:43.940] Checking ssh with "C:\Users\Alex\.dotnet\tools\ssh.exe -V"
[19:50:43.941] Got error from ssh: spawn C:\Users\Alex\.dotnet\tools\ssh.exe ENOENT
[19:50:43.941] Checking ssh with "C:\ffmpeg\bin\ssh.exe -V"
[19:50:43.943] Got error from ssh: spawn C:\ffmpeg\bin\ssh.exe ENOENT
[19:50:43.943] Checking ssh with "C:\Users\Alex\AppData\Local\Programs\Microsoft VS Code\bin\ssh.exe -V"
[19:50:43.945] Got error from ssh: spawn C:\Users\Alex\AppData\Local\Programs\Microsoft VS Code\bin\ssh.exe ENOENT
[19:50:43.945] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[19:50:43.973] > OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3

[19:50:43.975] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V"
[19:50:43.976] Got error from ssh: spawn C:\Program Files\Git\usr\bin\ssh.exe ENOENT
[19:50:43.977] Checking ssh with "C:\Program Files (x86)\Git\usr\bin\ssh.exe -V"
[19:50:43.978] Got error from ssh: spawn C:\Program Files (x86)\Git\usr\bin\ssh.exe ENOENT
[19:50:43.979] Checking ssh with "C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin\ssh.exe -V"
[19:50:43.981] Got error from ssh: spawn C:\Program Files\Microsoft\jdk-11.0.16.101-hotspot\bin\ssh.exe ENOENT
[19:50:43.981] Checking ssh with "C:\Program Files\PerkinElmerInformatics\ChemOffice\ChemScript\Lib\ssh.exe -V"
[19:50:43.982] Got error from ssh: spawn C:\Program Files\PerkinElmerInformatics\ChemOffice\ChemScript\Lib\ssh.exe ENOENT
[19:50:43.983] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[19:50:43.984] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[19:50:43.984] Checking ssh with "C:\Windows\ssh.exe -V"
[19:50:43.986] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[19:50:43.986] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[19:50:43.988] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[19:50:43.988] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[19:50:43.989] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[19:50:43.990] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[19:50:44.019] > OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3

[19:50:44.024] Using SSH config file "C:\Users\Alex\.ssh\config"
[19:50:44.025] askpass server listening on \\.\pipe\vscode-ssh-askpass-84310c3656910d467b470cb02b71a997f64a03ed-sock
[19:50:44.025] Spawning local server with {"serverId":1,"ipcHandlePath":"\\\\.\\pipe\\vscode-ssh-askpass-d2553ea578858802af0929ce8aeee3532dc46aaa-sock","sshCommand":"C:\\Windows\\System32\\OpenSSH\\ssh.exe","sshArgs":["-v","-T","-D","49730","-F","C:\\Users\\Alex\\.ssh\\config","harper","bash"],"serverDataFolderName":".vscode-server","dataFilePath":"c:\\Users\\Alex\\AppData\\Roaming\\Code\\User\\globalStorage\\ms-vscode-remote.remote-ssh\\vscode-ssh-host-aeb7b157-e7e037083ff4455cf320e344325dacb480062c3c-0.106.5-tr\\data.json"}
[19:50:44.025] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"c:\\Users\\Alex\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.106.5\\out\\local-server\\askpass.bat","VSCODE_SSH_ASKPASS_NODE":"C:\\Users\\Alex\\AppData\\Local\\Programs\\Microsoft VS Code\\Code.exe","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"c:\\Users\\Alex\\.vscode\\extensions\\ms-vscode-remote.remote-ssh-0.106.5\\out\\askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"\\\\.\\pipe\\vscode-ssh-askpass-84310c3656910d467b470cb02b71a997f64a03ed-sock"}
[19:50:44.037] Spawned 16564
[19:50:44.223] > local-server-1> Running ssh connection command: "-v -T -D 49730 -F C:\\Users\\Alex\\.ssh\\config harper bash"
[19:50:44.258] > local-server-1> Spawned ssh, pid=16660
[19:50:44.354] stderr> OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
[19:50:44.376] stderr> OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
[19:50:44.428] stderr> debug1: Server host key: ssh-ed25519 SHA256:gQ8tRvY3j3Fv63SlAxHuOg+xQJrnNo6CMZklBFsjIfA
[19:50:44.564] stderr> Authenticated to 128.192.9.183 ([128.192.9.183]:22).
[19:50:46.287] stderr> debug1: Server host key: ssh-ed25519 SHA256:EfzGTfCo1hSLtpzJbLedz/87kKMClMZPTZZLzJteViY
[19:50:54.354] stderr> Authenticated to harper (via proxy).
[19:50:54.436] stderr> /home/alex/.bashrc: line 85: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 88: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 89: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 90: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 91: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 92: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 93: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 94: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 95: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 97: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 98: module: command not found
[19:50:54.446] stderr> /home/alex/.bashrc: line 99: module: command not found
[19:50:54.447] stderr> /home/alex/.bashrc: line 100: module: command not found
[19:50:54.491] > ready: 39895a1225bd
[19:50:54.496] > Linux 3.10.0-1160.62.1.el7.x86_64 #1 SMP Tue Apr 5 16:57:59 UTC 2022
[19:50:54.496] Platform: linux
[19:50:54.500] > /bin/bash
[19:50:54.500] Shell: bash
[19:50:54.500] Creating bash subshell inside "bash"
[19:50:54.509] > bash version:  4.2.46(2)-release
[19:50:54.537] > 39895a1225bd: running
[19:50:54.593] > Creating the server install dir failed...
39895a1225bd: start
exitCode==34==
listeningOn====
osReleaseId====
arch====
vscodeArch====
bitness====
tmpDir==/run/user/1000123==
platform====
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
39895a1225bd: end
[19:50:54.594] Received install output: 
exitCode==34==
listeningOn====
osReleaseId====
arch====
vscodeArch====
bitness====
tmpDir==/run/user/1000123==
platform====
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====

[19:50:54.594] Failed to parse remote port from server output
[19:50:54.594] Terminating local server
[19:50:54.597] Resolver error: Error: 
at g.Create (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:640937)
at t.handleInstallOutput (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:638303)
at e (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:698535)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:720404
at async t.withShowDetailsEvent (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:724063)
at async c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:695240
at async C (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:693291)
at async t.resolveWithLocalServer (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:694780)
at async I (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:717627)
at async t.resolve (c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:721434)
at async c:\Users\Alex\.vscode\extensions\ms-vscode-remote.remote-ssh-0.106.5\out\extension.js:2:905238
[19:50:54.601] ------




[19:50:54.605] Local server exit: null

First, I tried "Remote-SSH:Kill VS-Code Server on Host". This didn't work.

Then I deleted .vscode and .vscode-server on another guy's advice. And now I'm at where the log shows rn. It still says "Could not establish connection to harper"

TL;DR ssh in terminal works. Remote-ssh in vscode does not anymore (it did before)

0

There are 0 answers