51

I'm trying to connect to a server via remote-ssh extension for Visual Studio Code, however, I'm getting the following error:

The vscode server failed to start SSH

Everything is fine on the server-side, and the connection to this host worked fine for a while.

Any suggestions to re-access the server via remote-ssh extension?

0

16 Answers 16

112

After a while, I found a solution that can be useful to others.

In VS Code press:

CTRL + SHIFT + P

Type or select the option:

Remote-SSH: kill VS Code Server on Host...

enter image description here

Select the host name:

enter image description here

And after this procedure, try connecting again to the host.

That worked for me.

Sign up to request clarification or add additional context in comments.

3 Comments

Worked! Do you know why this is needed?
Glad to hear it worked for you! To be honest, I'm not exactly sure why this is needed, but it seems to be a common solution for some remote SSH connection issues in VS Code.s
About how to force restart remote server: code.visualstudio.com/docs/remote/…
43

The release notes of the new VS-Code 1.86 (Jan 2024) reads:

From this release onwards, VS Code desktop is only compatible with Linux distributions based on glibc 2.28 or later, and glibcxx 3.4.25 or later, such as Debian 10, RHEL 8, or Ubuntu 20.04.

If you don't have the required version of the mentioned programs on the server side, you better revert to the previous version of VS-Code (v1.85). To do so, uninstall your current (v1.86) VS-Code, download v1.85 from the link below, and install it. https://code.visualstudio.com/updates/v1_85

Linux users can easily run the following command until the next release; run it after you uninstall the current (v1.86) VS-Code:

sudo apt install code-exploration

Comments

11

In my case it was ssh plugin issue. I updated remote ssh plugin then it worked

1 Comment

Current release version v0.100 failed trying to connect to a raspberry pi. Deleting ~/.vscode-server on the pi and using v0.101.2023041015 (pre-release as of today) worked for me.
11

One other possible reason is your remote machine may not have enough space. So check that.

Comments

8

Remote-SSH: kill VS Code Server on Host...

Didn't work for me, so I tried the other option:

Remote-SSH: Uninstall VS Code Server from Host...

It took a bit more time but worked for me!

Comments

8

Remove vscode server config from home dir

  • run rm -rf ~/.vscode-server
  • then try connecting again, it worked for me

2 Comments

Do you know why this resolves the error?
tar package was not installed on a system, can't unpack vscode-server installation files.
2

For Raspberry Pi:

Ok so it seems I was able to find a workaround provided here.

"I think you're having the same issue as me, but it's actually caused by an update to the pi. VScode is reading the uname -m value, the machine hardware name, which is returning aarch64, and so it is trying to run the 64 bit version of the remote server. In reality, your pi is likely using a armv7l (32 bit) user space. Remove the vscode remote server currently on the pi, then add arm_64bit=0 to /boot/config.txt and restart. If uname -m returns armv7l, then vscode should work again."

  • Remove vscode server from RPi: rm -rf ~/.vscode-server on the RPi.
  • Add the arm_64bit=0 to /boot/config.txt and restart as stated above on the RPi.
  • Start your vscode again from the host and start your remote connection. This will download the correct server.

Source

Comments

1

I was banging my head against a wall with this as well but as it turns out, VS Code will fail to install on the remote machine if tar is not present on the remote machine. Make sure tar is installed and try again, because the installation script that it runs seems to take advantage of that program.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
0

Everything is fine on the server-side, and the connection to this host worked fine for a while.

In case it is a simple intermittent network issue, VSCode 1.70 (July 2022) will retry the connection for you (up to 5 times)

See issue 127565 and PR 156444

Retry up to 5 times the initial authority resolving and also retry up to 5 times the initial connection

When connecting to a remote, if the initial connection fails, we will give up. The idea was that retrying would be useless, since the initial setup might have failed.

But it is possible that perhaps it was an intermittent network error.

This is available in VSCode insiders today.

Comments

0

If killing "vscode-server" did not solve it for you, it might be that there's not enough space on the remote server hard drive so it fails to fully download the necessary files and unfortunately, this scenario gives no appropriate log

Comments

0

Version 1.86.1 brings a temporary patch allowing VScode users to connect to unsupported OS version again (old Linux distributions). See the issue's conclusion : https://github.com/microsoft/vscode/issues/203375

Comments

-1

wrong proxy setting may cause problem. If Remote-SSH: kill VS Code Server on Host command not work for you, open settings and clear proxy setting and retry.

Comments

-1

Update the Remote ssh check file groups belongs to same group if you manually copied .vscode-server

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
-1

If you also have dev containers running on the remote host. You may fail to kill the vscode-server (thus somehow fail to reconnect) since the vscode-server in containers are running as root on the remote host. You need to first kill the running containers (docker stop <container_name>) and try reconnecting again.

Comments

-1

I have tried all methods provided by former answers, but none of them worked. Finally, the problem solve by the update of Vscode severse.

Comments

-1

For me what worked was the ">Remote-SSH Uninstall VS code Server from host" option. Good luck.

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.