Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS Code Remote SSH Connection not working

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] [email protected]
[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```
like image 501
000 Avatar asked Sep 23 '20 19:09

000


People also ask

Could not establish connection to the remote Host VS Code?

Open the command panel (Ctrl+Shift+P for Windows and Cmd+Shift+P for Mac), search for Kill VS Code Server on Host, and locate the affected instance, which will be automatically cleared. Then, establish the connection again.

How do I connect to a remote server using VS Code?

Connect to a remote host Verify you can connect to the SSH host by running the following command from a terminal / PowerShell window replacing user@hostname as appropriate. In VS Code, select Remote-SSH: Connect to Host... from the Command Palette (F1, Ctrl+Shift+P) and use the same user@hostname as in step 1.

Can you SSH with VS Code?

VS Code Remote SSHYou can connect over SSH into another machine from Visual Studio Code and interact with files and folders anywhere on that remote filesystem. If you have an app located on a different computer, you could use SSH to connect to it and access your app, view its files, and even modify, run, and debug it.


2 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.

like image 166
Mohamed Allal Avatar answered Oct 02 '22 19:10

Mohamed Allal


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
like image 23
Creeki Avatar answered Oct 02 '22 20:10

Creeki