VS Code Remote SSH Connection not working

Viewed 67506

Im trying to setup vscode with the remote developement extensions on a second pc. While it works on my main one it doesnt on the second one. Tried reinstalling vscode, extensions and using older versions but nothing works.

When trying to connect it cancels after chosing the os. So I cant even type in the password. I set it up in the exact same way as with the other pc.

Any ideas?

[20:32:53.595] remote-ssh@0.55.0
[20:32:53.595] win32 x64
[20:32:53.596] SSH Resolver called for "ssh-remote+ssh.blabla", attempt 1
[20:32:53.597] SSH Resolver called for host: ssh.blabla
[20:32:53.597] Setting up SSH remote "ssh.blabla"
[20:32:53.610] Using commit id "58bb7b2331731bf72587010e943852e13e6fd3cf" and quality "stable" for server
[20:32:53.612] Install and start server if needed
[20:32:54.639] Checking ssh with "ssh -V"
[20:32:54.686] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5

[20:32:54.691] Running script with connection command: ssh -T -D 52819 ssh.blabla bash
[20:32:54.694] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[20:32:54.758] >
]0;C:\WINDOWS\System32\cmd.exe
[20:32:54.758] Got some output, clearing connection timeout
[20:32:54.785] >
[20:32:55.045] > root@blabla's password: 
[20:32:55.045] Showing password prompt
[20:32:57.596] "install" terminal command done
[20:32:57.597] Install terminal quit with output: root@blabla's password: 
[20:32:57.597] Received install output: root@blabla's password: 
[20:32:57.598] Stopped parsing output early. Remaining text: root@blabla's password:
[20:32:57.598] Failed to parse remote port from server output
[20:32:57.603] Resolver error: Error: 
    at Function.Create (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:1:130564)
    at Object.t.handleInstallOutput (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:1:127671)
    at I (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:106775)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:104774
    at async Object.t.withShowDetailsEvent (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:109845)
    at async Object.t.resolve (c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:107960)
    at async c:\Users\Manuel.vscode\extensions\ms-vscode-remote.remote-ssh-0.55.0\out\extension.js:127:141955
[20:32:57.606] ------




[20:32:59.376] Password dialog canceled
[20:32:59.376] "install" terminal command canceled```
12 Answers

Depending on the system you are in! When you first try to connect! A vscode-server will be set up and configured on your server!

In linux that can be in /Home/<user>/.vscode-server !

If you are on windows check what that is!

The first solution is to try the extension command: Remote-SSH: kill VS Code Server on Host

Open the command pallet (CTRL + SHIFT + P or COMMAND + SHIFT + P (mac) ).

And type Remote kill :

enter image description here

Then try to connect again! (That will kill the server on the host! Which will make it start again on the next try)

If that doesn't work! And still failing!

Delete, rm

Then a good solution that can work is: to connect to your server through terminal (vscode terminal, gnome-terminal, whatever)! Then go and remove /Home/<user>/.vscode-server

Try to connect after it! At the attempt the server will be re-installed completly all anew! And good chances it will works! (I did that and it worked! So whatever that was going wrong on the vscode-server! you start all over! And the state or whatever go a new and problem resolved!

However you loose things, config, meta data, ... (you start a new!) In my case it didn't matter! (Note: check the update section. If u don't want to loose the settings data ...)

One can explore the .vscode-server structure, and elements! And you can save some part that you bring up later! (I didn't check!) (may do later)! It's an option!

Update:

As stated by @natevw im the comments:

I found that removing only the .vscode-server/bin subfolder helped straighten things out and afaict kept my data/settings.

Removing only vscode-server/bin seems to work well. And the config, metadata remains untouched.

I downgrade Remote-SSH plugin to 0.51.0, rm -rf $HOME/.vscode-server on the remote machine. Connect again, VSCode will download and install a new .vscode-server. Then upgrade Remote-SSH plugin, everything works.

I met the same problem. After I did these steps, it works:

on the remote server:

rm -rf ~/.vscode-server  
rm -rf ~/.vscode

On the local VS code:

reinstall remote-ssh

One way worked for me is, by adding this line in the vscode settings (JSON) file.

"remote.SSH.useLocalServer": false

VSCode settings

In case all the above fails, here's how I fixed my issue.

First, I was able to SSH into my remote server (Ubuntu 22.04, Raspberry Pi 4, arm64) using a simple bash terminal. So I logged in using my terminal (macOS), and I went to

cd $HOME/.vscode-server/bin/WHATEVER-HASH-YOU-HAVE/

In this directory, there is a file named server.sh. I tried running this script, and I got the following error:

./node: error while loading shared libraries: libatomic.so.1: cannot open shared object file: No such file or directory

The issue was clear: there was a missing shared library on my system. Either Node.js now requires that or the new version of the SSH-Remote extension; I don't know. I did not spent the time to dig into those specifics.

But to fix that, I simply did:

sudo apt-get install libatomic1

That installed the missing shared library.

After that, I delete $HOME/.vscode-server:

rm -rf $HOME/.vscode-server

and tried again connecting using VSCode. It worked!

Hope this can help someone like me, for whom all other options failed.

It turns out that my fish was a obstacle for vscode server.

Then I tried

chsh -s /bin/bash

And works fine.

I worked adding \\ in the path of the .config

I share the steps

  • Go to .config settings

  • select configuration

  • add double \\

Just deleted old host information from ssh settings file and problem solved.

I had faced this issue when I tried to connect to a Linux server from a windows laptop. It was using the wrong fingerprint. It worked for me after removing the line related to that server from $HOME/.ssh/known_hosts

I ran into the same issue, it got fixed when I updated the path of the IdentityFile from 'ssh_key' to '~/.ssh/ssh_key' (the entire path I mean) so that the VS code could recognize it.

Restart remote machine worked for me (after trying all the previous answers with no luck).

Related