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
...
Related
I'm using VSCode 1.72.2 with Remote-SSH v0.90.1 on Windows to develop against an AWS EC2 VM running Ubuntu 22.04 LTS. A couple days ago, I was working in my project source folder in /opt/t4/ on the target host. When I was finished, I stopped the VM from the AWS console, forgetting that VS Code was still SSHed in.
When I brought the VM back up, I can reconnect VS Code/Remote-SSH to the host as before, except that I can no longer connect using /opt/t4/ as my working directory. I can use any directory except the one I was using when I disconnected.
I can navigate down to it and work in it if I use /opt/ as my working directory. I can navigate to it by manually SSHing to the remote host. I can create a subfolder in a remote shell at /opt/t4/test/, and then connect VS Code using that subfolder as my working directory. I can see and select /opt/t4/ in the Open Folder dialog in VS Code. But when I try to connect using that working directory, the connection times out with a not-particularly-useful error message:
[00:05:49.867] SSH Resolver called for "ssh-remote+my.remote.host", attempt 2, (Reconnection)
[00:05:49.868] SSH Resolver called for host: my.remote.host
[00:05:49.868] Setting up SSH remote "my.remote.host"
[00:05:49.870] Using commit id "d045a5eda657f4d7b676dedbfa7aab8207f8a075" and quality "stable" for server
[00:05:49.872] Install and start server if needed
[00:05:49.874] Using SSH config file "C:\Users\me\.ssh\config"
[00:05:49.874] Running script with connection command: ssh -T -D 1518 -F "C:\Users\me\.ssh\config" "my.remote.host" bash
[00:05:49.875] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[00:06:06.876] Resolver error: Error: Connecting with SSH timed out
at g.Timeout (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:585348)
at Timeout._onTimeout (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.90.1\out\extension.js:1:679743)
at listOnTimeout (node:internal/timers:559:17)
at process.processTimers (node:internal/timers:502:7)
[00:06:06.877] ------
I tried Remote-SSH: Uninstall VS Code Server from Host from VS Code.
I tried deleting ~/.vscode-server on the Linux host from an SSH session.
I tried Remote-SSH: Kill VS Code Server on Host from VS Code.
I tried Remote-SSH: Kill Local Connection Server for Host from VS Code.
I tried deleting and recreating the host connection details in the local config file from SSH-Remote.
I tried rebooting both local and target hosts.
I tried setting /opt/ as my working dir, then deleting and recreating /opt/t4. I was able to do this, but as soon as I try reconnecting using /opt/t4 as the working dir, VS Code still fails to connect.
I'm... stumped. My suspicion is that there is something corrupt cached Windows-side, but I don't know where to look for that.
Microsoft is aware and working on a fix. There are a variety of workarounds in this thread: https://github.com/microsoft/vscode-remote-release/issues/7324
Thanks to the link from #Mike Barry, I managed to find the local workspace for that target folder and delete it to force it to reinitialize, which cleared the issue.
Deleted C:\Users\me\AppData\Roaming\Code\User\workspaceStorage\[guid]\ and reconnected with no problem.
[Problem Description]
When I work on setting VS Code remote ssh on a new server, I find this error:
"Could not establish connection to "XXX.XXX.XXX.XXX":Downloading VS Code Server failed - please install either curl or wget on the remote".
However, I have curl and wget installed on my remote server. And the network connection on my remote server is also fine. Following some tutorials in the web, I download vscode-server on the remote side by:
wget vscode-server-linux-x64.tar.gz https://update.code.visualstudio.com/commit:<commit-id>/server-linux-x64/stable
and then extract it, copy to ~/.vscode-server/bin/<commit-id>/, and replaced the files there.The error message disappears.
It works fine at the beginning, but everytime I close and reopen project on the remote server, VsCode would start to download remote server automatically and then collapse to so called "please install either curl or wget on the remote". Moreover, the VsCode built-in terminal would fail to no cuda environement or GPU driver error(Cuda and driver work fine on remote side) even if I fortunately connect to remote at chance.
[Environment]
Local Side:
MacOS Big Sur 11.2.3 + VsCode 1.50.1 + Remote-SSH Extension(Microsoft) 0.6.1
Remote Side
Ubuntu 18.04.5 + Wget 1.19.4 + Curl 7.58.0
[Log]
[10:57:03.119] Neither curl nor wget is installed - can't download the Server
[10:57:03.125] Resolver error: Error: Downloading VS Code Server failed - please install either curl or wget on the remote.
at Function.ServerInstallError (/Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:1:82253)
at /Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:1:79401
at Object.t.handleInstallOutput (/Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:1:80935)
at I (/Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:127:107056)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async /Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:127:104971
at async Object.t.withShowDetailsEvent (/Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:127:110308)
at async Object.t.resolve (/Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:127:108372)
at async /Users/XXX/.vscode/extensions/ms-vscode-remote.remote-ssh-0.61.0/out/extension.js:127:129627
[10:57:03.131] ------
[10:57:03.428] "install" terminal command done
[10:57:03.429] Install terminal quit with output:
This may be because there are so many vscodes open on the remote server that you need to kill all the VSCODE processes on the remote server and then try to connect again or make a new connection, save host information.
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.
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)
I've checked my Hyper-V settings and PowerShell Module is enabled. I've also found this documented issue: https://github.com/docker/machine/issues/4342 but it is not the same issue since I do not have VMware PowerCLI installed. The issue was closed with a push to the repo and is supposedly fixed in 0.14.0-rc1, build e918c74 so I tried it anyways. After replacing my docker-machine.exe, I'm still getting the error and still getting the error even if I reinstall Docker for Windows.
For some more background, this error starting happening after a reinstall because my Docker install had an error: https://github.com/docker/for-win/issues/1691, however, I'm not longer getting that issue after reinstalling.
For those who struggle with this issue in Windows, Follow the instruction here
When creating a Hyper-v VM using docker-machine on win10, an error was returned"Error with pre-create check: "Hyper-V PowerShell Module is not available"。
The solution is very simple. The reason is the version of the docker-machine program. Replace it with v0.13.0. The detailed operation is as follows:
Download the 0.13.0 version of the docker-machine command. Click to download: 32-bit system or 64-bit system
After the download is complete, rename and replace the " docker-machine.exe " file in the " C:\Program Files\Docker\Docker\resources\bin" directory. It is best to back up the original file.
Here is the solution
https://github.com/docker/machine/releases/download/v0.15.0/docker-machine-Windows-x86_64.exe
Save the downloaded file to your existing directory containing docker-machine.exe.
For my system this is the location for docker-machine.exe
/c/Program Files/Docker/Docker/Resources/bin/docker-machine.exe
Backup the old file and replace it file with the new one.
cp docker-machine.exe docker-machine.014.exe
Rename the downloaded filename to docker-machine.exe
mv docker-machine-Windows-x86_64.exe docker-machine.exe
Build Instructions
Create virtual switch in Hyper-V manager named myswitch
Request Docker to create a VM named myvm1
docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1
Results
docker-machine create -d hyperv --hyperv-virtual-switch "myswitch" myvm1
Running pre-create checks...
(myvm1) Image cache directory does not exist, creating it at C:\Users\Trey Brister\.docker\machine\cache...
(myvm1) No default Boot2Docker ISO found locally, downloading the latest release...
(myvm1) Latest release for github.com/boot2docker/boot2docker is v18.05.0-ce
(myvm1) Downloading C:\Users\Trey Brister\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.05.0-ce/boot2docker.iso...
(myvm1) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(myvm1) Copying C:\Users\Trey Brister\.docker\machine\cache\boot2docker.iso to C:\Users\Trey Brister\.docker\machine\machines\myvm1\boot2docker.iso...
(myvm1) Creating SSH key...
(myvm1) Creating VM...
(myvm1) Using switch "myswitch"
(myvm1) Creating VHD
(myvm1) Starting VM...
(myvm1) Waiting for host to start...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!
To see how to connect your Docker Client to the Docker Engine running on this virtual machine, run: C:\Program Files\Docker\Docker\Resources\bin\docker-machine.exe env myvm1
(1),
V0.15 fixed this issue officially:
Fix issue #4424 - Pre-create check: "Hyper-V PowerShell Module is not available"
Official Introduction:
https://github.com/docker/machine/pull/4426
Address to donload V0.15
https://github.com/docker/machine/releases
(2),
I tested this, it works fine.
No need restart docker
It take effect immdiately after the "docker-machine.exe" is replaced with version 0.15
(3),
Backup the original one is a good habit
Just start docker desktop if you are on Windows