Remote ssh is hanging on checking log and pid in VSCode-Server - remote-server

After downloading VSCode-Server, the remote SSH is hanging on checking log and pid which does not exist at the remote server.
65a78c9b5eba: running
Acquiring lock on /root/.vscode-server/bin/379476f0e13988d90fab105c5c19e7abc8b1dea8/
vscode-remote-lock.root.379476f0e13988d90fab105c5c19e7abc8b1dea8
Found existing installation at /root/.vscode-server/bin/379476f0e13988d90fab105c5c19e7abc8b1dea8...
Checking /root/.vscode-server/.379476f0e13988d90fab105c5c19e7abc8b1dea8.log
and /root/.vscode-server/.379476f0e13988d90fab105c5c19e7abc8b1dea8.pid for a running server

I had the same issue and creating the two files that are checked did the trick, i.e. in your case:
touch /root/.vscode-server/.379476f0e13988d90fab105c5c19e7abc8b1dea8.log
touch /root/.vscode-server/.379476f0e13988d90fab105c5c19e7abc8b1dea8.pid

Related

VS Code Remote-SSH won't reconnect to one specific working directory on remote Ubuntu host

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.

Trying to connect to server via SSH with VSCode

I've got my SSH keys in place, and can log into the server just fine from my terminal, but when trying to SSH via VSCode... I get the following errors over and over again:
ssh fork: retry: No child processes
I also noticed that when VSCode is connecting to my server... I can't connect via SSH in Terminal, and I have to manually halt the processes for VSCode on the server to be able to connect again.
Any ideas on this one?
The error is the result of the parent process waiting the child after a fork().
The error means that your running low on resources or you have created to many processes and the bash can no longer create any process.
Can you avoid automatically connection retries?

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

Manage to connect through the terminal, but not through the remote explorer

I am coming from notepad, and am learning how to work with VS Code.
I am now trying to access my online repertory on the webserver.
I followed up the guide here: https://code.visualstudio.com/docs/remote/ssh
I did manage to access my server through the terminal window.
(ssh user#domain + password).
When connecting, this shows in the log:
"Linux infong-eu27 4.4.246-icpu-061 #2 SMP Thu Nov 26 10:58:41 UTC 2020 x86_64"
This tells me that it is working on Linux.
If I type "Ls", I can see my folders and navigate among them.
So far, so good!
Second phase: Connecting through the remote explorer.
Step 1:
I configured the ssh with the same credentials I used with the terminal.
Step 2:
I am opening the remote explorer, I can see my server's name. I right click on it and select "connect".
Step 3:
I am then asking to choose the system. I am picking Linux as shown earlier when connecting through the terminal.
Step 4: I am entering the same password I used before to connect in the terminal.
Step 5: Infinite loading, or a very long one till I get 2 notifications / errors:
Could not fetch remote environment
Failed to connect to the remote extension host (error time limit..)
That being said, it also says in the bottom left corner, in the "remote window", that I am connected. This does not seems right.
Any chance someone could help?
I am frustrated because it connects in 1s using the terminal, but not in the remote explorer.
UPDATE:
I found this article on medium that paraphrases the official documentation.
https://medium.com/#sujaypillai/connect-to-your-remote-servers-from-visual-studio-code-eb5a5875e348
I managed, through Git bash, to create a ssh pair key, and managed to copy one on my server.
I then followed the instructions on how to set it up on VS Code successfully!
Now, when I try to connect, I am asked for my key pass:
But, when I do: super long loading, and the same error message.
When I looked on my server with a sftp software, I see that VS did manage to connect as files were installed in a VS folder it created:
This is reported in issue 4415 (no answer) and issue 4204
The last one includes:
This might be caused by our new automatic port forwarding feature which scans the remote OS for available ports in order to forward them locally (microsoft/vscode#112843)
This is fixed by PR 113342, for the next 1.54 Feb. 2021 release. That bug is about setting remote.autoForwardPorts to false and... still seeing VSCode auto-forward ports!
Check on your server (while VSCode attempts to connect) if:
the CPU is high
if there are any services running on public port on said server
I solved a similar issue by following the error logs from the remote ssh extension. I had to install libatomic1 on the remote server with
sudo apt-get install libatomic1

What is veewee waiting for when it's waiting for ssh login?

When veewee is displaying the following message, Waiting for ssh login on 127.0.0.1 with user veewee to sshd on port => 7222 to work, timeout=10000 sec what exactly is it waiting on?
As far as I can tell there is a ssh server on port 7222 on the host that veewee has put up and it's waiting on that. This means that something in the guest is going to connect back to it. However, I can't figure out what that thing might be - and thus I can't debug further.
Further details
I'm trying to build a virtualbox image for vagrant with the CentOS-6.3-x86_64-minimal template. My steps:
bundle exec veewee vbox define 'ejs-centos6.3-1' 'CentOS-6.3-x86_64-minimal'
wget http://mirror.symnds.com/distributions/CentOS-vault/6.3/isos/x86_64/CentOS-6.3-x86_64-minimal.iso
bundle exec veewee vbox build 'ejs-centos6.3-1'
The CentOS install appeared to run without error but it's stuck waiting for the ssh login.
You're right, there's a Ssh server on listening on port 7222, but it's on the guest (VM), not the host.
The host (Veewee) is waiting to connect to it. This SSH service is supposed to become available when the VM install process finishes, that's one of the steps used by Veewee to assume that the setup went fine and that the VM is ready.
If Veewee blocks and never gets this SSH connection, I think there could be multiple reasons:
VM setup went wrong and something prevents it from finishing successfully. Check Veewee output and the Virtualbox VM graphical console that should have opened when launching vewee box build.
There's something preventing your host computer to connect to the VM at the network level.
The VM image doesn't have Sshd installed, and/or the veewee box configuration files (in veewee/definitions/ejs-centos6.3-1/) miss instructions to install the ssh package
You should try to login to the VM using Virtuabox console window and check if there's an ssh package installed (rpm -qa | grep openssh-server) and a process named sshd running.
I've run Veewee against Centos 7 built with GUI on and it stuck on anaconda asking for source of packages. I've checked the ks.cfg and it was pointing to dead resource (404). After pointing to valid url it went through.