FortyGazelle700
FortyGazelle700

Reputation: 135

Could not establish connection to "hostname": The VS Code Server failed to start

I looked at the similar questions to mine, and none of them seemed to fix my problem. It returns a prompt that says Could not establish connection to "hostname": The VS Code Server failed to start. When I use the command ssh pi@raspberrypi and type in my password everything seems to work.

My Computer: Windows 11

Remote Computer: Raspbian OS

The server.sh file seems to be broken, but I don't know what the file should look like:

#!/usr/bin/env sh
#
# Copyright (c) Microsoft Corporation. All rights reserved.
#

case "$1" in
    --inspect*) INSPECT="$1"; shift;;
esac

ROOT="$(dirname "$0")"

"$ROOT/node" ${INSPECT:-} "$ROOT/out/server-main.js" --compatibility=1.63 "$@"

and this is the log file on the remote computer:

/home/pi/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/bin/code-server: 12: /home/pi/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/bin/code-server: /home/pi/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5/node: not found

Upvotes: 1

Views: 20469

Answers (7)

marcfreir
marcfreir

Reputation: 65

If you are trying to access a node in a cluster, for example, another issue, despite what have said, it's important to verify the space left in the disk. Verify with the command in bash df -h. If the availability of the space is 0%, i.e., 100% of the disk if full, you could consider this possibility. In this case, any larger files could be deleted from the disk. For example:

Let's say you are logged with something like user_id@node01:~/some_folder, and you type df -h, and get something like:

Filesystem                        Size  Used Avail Use% Mounted on
tmpfs                              26G  5,1M   26G   1% /run
/dev/nxbe0n0p1                    645G  573G   39G  94% /

Here, the /dev/nxbe0n0p1 is almost full. If in the column Use% has 100%, you could face with the problem of Could not establish connection to "<host>".

So, just consider this possibility, if all the above do not solve your problem.

Some of the situations that can cause this type of issue are: no left space on the disk available for the user, misconfiguration of the ssh key, or misconfiguration of the .config file.

Good luck!

🐍🔥

Upvotes: 0

Ying Zhong
Ying Zhong

Reputation: 1

Upgrading from 1.87 to 1.88 helps me out

Upvotes: 0

Michael James
Michael James

Reputation: 1

If you tried above solutions, you can try this...

Possible Rootcause:

  • Tar package is not installed on remote machine, which is used unpack downloaded files at remote machine

Conditions:

  • VS Code remote via SSH
  • passed on password prompt twice, then the error like this occurs: "vscode remote could not establish connection"
  • Check the remote machine if there's existing ".vscode" file at /home directory (if not, chances are it fails at SSH)
  • Verdict: SSH is definitely working based on logs & it stores data at remote machine

Solution:

  • Install tar package at remote machine

Upvotes: 0

Lampros Fotiadis
Lampros Fotiadis

Reputation: 1

Has same issues, after upgrading to latest v1_86, tried everything I could find in stackoverflow, nothing worked.

I am using latest macOS (Sonoma) on an Intel-based macbook pro 16 (2019) and remote the server is ubuntu 22.04.

Looking at the log it seems that the connection is established successfully but then something fails.

Had to downgrade to previous version (1_85), as also @chrischma suggested. This worked!

Upvotes: 0

chrischma
chrischma

Reputation: 163

If none of the suggested ways work, try downgrading to this version of vsc: https://code.visualstudio.com/updates/v1_85

this was the only way i could make it work again.

good luck!

Upvotes: 0

jeongwhanchoi
jeongwhanchoi

Reputation: 136

Another solution: Remote-SSH: Uninstall VS Code Server from Host work

You can find Remote-SSH: Uninstall VS Code Server from Host... via the command palette (ctrl/cmd + shift + p).

Remote-SSH: Uninstall VS Code Server from Host

And if you select or enter the host IP, the vscode installed on that server will be uninstalled.

enter image description here

Then, if you connect to the server again through vscode-ssh, vscode will work well. After several attempts, I also succeeded in connecting this way.

Upvotes: 2

tremendous
tremendous

Reputation: 176

solution :Kill VS code Server on host and reconnect maybe work

  • show Command Palette : ctrl + shift +p
  • input keyword : Remote-SSH
  • select target : Remote-SSH: Kill VS Code Server on Host...
  • reconnect target serer will work

Upvotes: 14

Related Questions