server.sh not found when establishing vscode remote ssh connection - visual-studio-code

I get the following error when connecting to a remote host to setup remote SSH connection.
Server did not start successfully. Full server log >>>
[09:58:46.599] > bash: line 212: /u/kasula/.vscode-server/bin/036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8/server.sh: No such file or directory
<<< End of server log
Not sure how to proceed, and no more information in the log file or terminal.
Please help.

I had the same issue too.
My local OS is macOS 10.15.4, and the remote OS is CentOS 8.
It turns out that CentOS 8 doesn't installed tar as default. So I just install it (sudo yum install tar), and then connect to remote again in VSCode and it works.

I have the same issue.
The server.sh file is nowhere to be found.
[18:10:19.668] > Server did not start successfully. Full server log >>>
> bash: line 302: /root/.vscode-server/bin/26076a4de974ead31f97692a0d32f90d735645c
> 0/**server.sh: No such file or directory**
> <<< End of server log
Update after solving the issue:
In my case, VSCODE couldn't download the server.sh file. I gave the linux server permission to download from these two sites and the problem was solved.
update.code.visualstudio.com or (https://visualstudio.com with all prefixes)
vo.msecnd.net or (https://msecnd.net with all prefixes)

Related

How to stop reinstalling VS Code Server over SSH

I installed Remote - SSH extension for VS Code 9v 1.63.2) on Windows 10. I successfully connect to a linux remote machine and can edit my files remotely over the SSH server. But for some reason every time I boot up this project, it deletes, redownloads, and re-installs the server. This takes a while with my internet connection. Anyway to force it to re-use the existing install?
A sample log:
Acquiring lock on /home/myuser/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3/vscode-remote-lock.myuser.899d46d82c4c95423fb7e10e68eba52050e30ba3
Found old VS Code install f4af3cbf5a99787542e2a30fe1fd37cd644cc31f, attempting to clean up
Deleting old install from /home/myuser/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f
rm: cannot remove '/home/myuser/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f': Directory not empty
Deleting old log file from /home/rmchh/.vscode-server/.f4af3cbf5a99787542e2a30fe1fd37cd644cc31f.log
Installing to /home/myuser/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3...
172891dd6284%%1%%
Downloading with wget
wget download failed
https://update.code.visualstudio.com/commit:899d46d82c4c95423fb7e10e68eba52050e30ba3/server-linux-x64/stable: 2021-12-17 03:44:39 ERROR 503: Service Unavailable.
printenv:
PWD=/home/myuser/.vscode-server/bin/899d46d82c4c95423fb7e10e68eba52050e30ba3
...

VScode SSH extension stuck on the installation step

For the past few months, I've used this VSCode Extension to work remotely on a linux server via SSH. I'll occasionally have a connection problem, but sshing from a terminal and deleting ~/.vscode-server/ has always fixed it. This time, though, that didn't fix it. I've tried deleting the folder multiple times, I've removed and reinstalled the VSCode extension, restarting my computer, everything I could think of. But each time, it gets stuck at downloading with wget, even if I leave it going for hours. I can connect to the server by sshing directly just fine, and other people I know can connect to the server through the extension as well. Is there anything else I can try to get this working?
Here's the full installation log (with the host name censored):
[19:17:22.756] Log Level: 2
[19:17:22.758] remote-ssh#0.56.0
[19:17:22.758] win32 x64
[19:17:22.759] SSH Resolver called for "ssh-remote+my.host.name", attempt 1
[19:17:22.759] SSH Resolver called for host: my.host.name
[19:17:22.760] Setting up SSH remote "my.host.name"
[19:17:22.776] Using commit id "e5a624b788d92b8d34d1392e4c4d9789406efe8f" and quality "stable" for server
[19:17:22.777] Install and start server if needed
[19:17:22.800] Checking ssh with "ssh -V"
[19:17:22.831] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[19:17:22.836] Running script with connection command: ssh -T -D 52457 my.host.name bash
[19:17:22.838] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[19:17:22.889] >
>
>
> ]0;C:\WINDOWS\System32\cmd.exe
[19:17:22.889] Got some output, clearing connection timeout
[19:17:22.898] >
>
>
>
[19:17:23.334] > 23b0d284345c: running
>
[19:17:23.363] > Acquiring lock on /path/to/home/.vscode-server/bin/e5a624b78
> 8d92b8d34d1392e4c4d9789406efe8f/vscode-remote-lock.my_username.e5a624b788d92b8d34
> d1392e4c4d9789406efe8f
>
[19:17:23.373] > Installing to /path/to/home/.vscode-server/bin/e5a624b788d92
> b8d34d1392e4c4d9789406efe8f...
> 23b0d284345c%%1%%
>
[19:17:23.381] > Downloading with wget
>
[19:17:27.721] > 23b0d284345c: running
> Acquiring lock on /path/to/home/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f/vscode-remote-lock.my_username.e5a624b788d92b8d34d1392e4c4d9789406efe8f
> Installing to /path/to/home/.vscode-server/bin/e5a624b788d92b8d34d1392e4c4d9789406efe8f...
> 23b0d284345c%%1%%
> Downloading with wget
>
I ended up getting it working. I was connecting to a Centos7 server, what worked for me was deleting ~/.wget-hsts. After that, it reinstalled the server and connected fine.
There are a few reports of a similar issue in the microsoft/vscode-remote-release project which implements for VSCode this feature.
For instance, issue 4008
The remote OS I am connecting to is a RHEL 7 Linux machine.
I tried fiddling with iptables and ports for the wget request to no avail.
It hangs for a little while at the wget step, and ultimately fails to connect. I tried tweaking just about every SSH setting in the remote.
The only other thing I noticed that might be related was with the Ports Available text at the bottom of the screen. It never reads anything other than 0 during the connection process. When I'm properly connected, it says 1 Port Available.
However, I did find a successful workaround: I rolled back the Remote SSH extension to 0.55.0 and it worked like a charm again.
So try and downgrade the Remote SSH extension, to see if it works.
I tried waiting for around 10 minutes and it downloaded. Don't know why although ✨

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] 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```
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 :
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 things are 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 that. At the attempt the server will be re-installed completely anew, chances are it will work. (I did that and it worked for me, so whatever that was going wrong on the vscode-server: just start all over)
But again: you will lose things, config, meta data, etc. (because you start anew).
Update:
As stated by #natevw in 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, etc. 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.
One way worked for me is, by adding this line in the vscode settings (JSON) file.
"remote.SSH.useLocalServer": false
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
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.
Issue: while trying to ssh connect to Linux(remote machine) using vscode.
Solution: remove/delete the bin folder inside .vscode-server and then reconnect to the remote machine
In remote server:
remote_name:~$ rm -rf ~/.vscode-server/bin
*reconnect to remote machine*
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).
Giving you the oldest trick of the book:
restart
It worked for me and I laughed hysterically for exactly 57 seconds. Happy reconnecting to the server my dear Coder!
I could not connect to the server, my issue was the remote server was full
check with the command df -h if the disk is full !
Here is an alternative for Remote SSH, pls check my answer at: https://stackoverflow.com/a/68046111/13089935
TLDR:
We can use a web-based VS Code that is installed on the server directly.

Remote editing over ssh to windows server

Remote SSH plugin states VS Code Insiders has experimental support for Windows 10/Server 1803+ using the official OpenSSH server.
I have the official OpenSSH server installed and configured on Windows Server 2019 1809. I can connect via pubkey authentication and have PowerShell Core over ssh working as well. I tried both Remote SSH and Remote SSH nightly plugin. At first it was complaining that it couldn't find bash. So I installed git bash and added it to the system path. I get the following error when attempting to connect to my windows server:
[16:02:41.398] Log Level: 3
[16:02:41.399] remote-ssh-nightly#2019.12.24000
[16:02:41.399] darwin x64
[16:02:41.401] SSH Resolver called for "ssh-remote+myserver", attempt 1
[16:02:41.401] SSH Resolver called for host: myserver
[16:02:41.401] Setting up SSH remote "myserver"
[16:02:41.413] Using commit id "e74405d11443c5361c31e2bc341866d146eee206" and quality "insider" for server
[16:02:41.414] Testing ssh with ssh -V
[16:02:41.425] ssh exited with code: 0
[16:02:41.425] Got stderr from ssh: OpenSSH_7.9p1, LibreSSL 2.7.3
[16:02:41.430] Running script with connection command: ssh -T -D 51951 -o ConnectTimeout=15 myserver bash
[16:02:41.430] Install and start server if needed
[16:02:43.451] > 5122b1a5b835: running
> Unsupported architecture: MINGW64_NT-10.0-17763 x86_64
> 5122b1a5b835##27##
[16:02:43.452] Got some output, clearing connection timeout
[16:02:43.710] "install" terminal command done
[16:02:43.710] Install terminal quit with output: 5122b1a5b835##27##
[16:02:43.710] Received install output: 5122b1a5b835##27##
[16:02:43.710] Unsupported architecture
[16:02:43.711] Resolver error: The remote host's architecture is not supported
[16:02:43.714] ------
Anybody know the magic sauce to get Remote SSH working w/ Windows 10/Server?
Looks like VSCode is attempting to run bash on the server which I'm guessing would resolve to git's bash which is mingw based as I recall. VSCode should be running Powershell on the server.
Did you include your server in the list of windows remotes in the extension's settings?
Requires "remote.SSH.windowsRemotes" setting. Here is the documentation.
"remote.SSH.windowsRemotes": ["myserver"]

Failed to parse remote port from server output: bash: no job control in this shell

I am trying to use VSCode - Insiders to run code on a docker container in a remote AWS machine using the Remote - SSH plugin. I have opened a terminal and set up port forwarding like so: ssh -L 2201:localhost:2222 user#host -N -i ~/.ssh/id_rsa. Then in VSCode I try to connect to root#localhost and it starts up, but then gives me an error message:
> Found existing installation...
> Found running server...
>
> bash: no job control in this shell
"install" terminal command done
Received install output: bash: no job control in this shell
Failed to parse remote port from server output: bash: no job control in this shell
I started doing this process a couple days ago and it worked. Yesterday it was in and out a bit, and today it's not working at all. I've tried turning it off and on again, but can't get it to work. In case it's relevant, I am on MacOS with the Mojave OS.
Edit:
Magically, it worked today (the following day) the first time. I would still be interested in knowing how to fix this next time it breaks. In case this helps, here's the output from when it is working:
SSH Resolver called for "ssh-remote+7b22686..."
SSH Resolver called for host: root#localhost
Setting up SSH remote "localhost"
Using commit id "473af338..." and quality "insider" for server
Using SSH config file "/Users/user/config"
Install and start server if needed
> Found existing installation...
> Found running server...
>
> bash: no job control in this shell
> 368805d0-03...==38466==
"install" terminal command done
Received install output: 368805d0-03...==38466==
Server is listening on port 38466
Using SSH config file "/Users/user/config"
Spawning tunnel with: ssh -F /Users/user/config root#localhost -N -L localhost:39003:localhost:38466
Spawned SSH tunnel between local port 39003 and remote port 38466
Waiting for ssh tunnel to be ready
Tunneling remote port 38466 to local port 39003
Resolving "ssh-remote+7b22686f737..." to "localhost:39003", attempt: 1
Edit 2: And now (the following following day) it's not working again.
Edit 3: I have a config file at ~/config. Here are the contents:
Host *
User root
Port 2201
IdentityFile ~/id_rsa
In the specific implementation shown above, you have User root in your config and are logging in with root#localhost, so you have your username twice. Leave the config file as is and just enter localhost in VSCode. This still doesn't solve the instability issue, but it does fix one problem.
I have the same issue when configuring my server. It solved by this issue. After save your config file for remote server, change the remote shell path like this issue, and then connect, you will in.
https://github.com/microsoft/vscode-remote-release/issues/220#issuecomment-490374437