VSCode Jupyter error when attempting to connect to remote server - visual-studio-code

I use VSCode Remote for development on an academic cluster and I am a frequent user of the Jupyter extension. On my cluster, I launch a Jupyter instance using Slurm and then use the "Connect to a Jupyter Server" option to connect to the instance. This was working well until today, when entering the URL for the Jupyter server caused the server selection interface to disappear with no error in the gui. In the Jupyter output, the following error is displayed:
info 15:49:09.478: Creating server with url : <URL>
info 15:49:09.549: Creating server with url : <URL>
error 15:49:10.417: Failed to enter Jupyter Uri, Class name = k, completed in 868ms,
has a falsy return value, Arg 1: "<URL>/?token=<TOKEN>",
Return Value: undefined [Error: UNIX[No such file or directory]]
What I have tried to debug:
Restart VSCode locally (nothing changes)
Restart the remote server (nothing changes)
Manually port forward and view the Jupyter notebook in Google Chrome (works)
Check for updates (no updates available, but this behavior might have been caused by an update)
Does anyone have any advice for how to debug the Jupyter extension to figure out what is going wrong? Thank you!

Related

Need help in solving Remote - SSH problem

Hello guys I am trying to do Remote SSH for quite some time and unable to make it work .
The problem :
Trying to connect to Aws Codecatalyst Dev environment Linux(remote ssh) to my local windows machine and it is in an endless loop of " Setting up SSH Host aws -exampleID".
I had tried it with my remote ubuntu aws workspace and it works flawlessly (ubuntu remote workspace to Aws codecatalyst Dev Environment) so it seems like some issue with my local machine .
Things I have tried:
When comparing the logs of failed vs successful I have noted that the remote.SSH.useLocalServer was true in my success log. So tried to add this to the settings.json but during run time it automatically changes from true to false .
Also tried clean uninstall and install couple of times (remove appData and ssh config files)
I have added an image of log of the failed Remote SSH .
Would appreciate if Remote SSH users can take a look into the logs and give their insights .
log of Remote SSH

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.

Enter commands in VSCode's Remote-SSH environment

I am using the VSCode extension Remote-SSH to connect to a remote server.
However, on this server, I can only login via the login node. I'm not allowed to run heavy tasks on this node, so I need to enter voltash to get transferred to a usable node.
I can do this by opening a new terminal. However, the current node remains unchanged on Remote-SSH:
Even though the terminal window says I am on n-62-27-20 (the name of the node I'm currently on, in the terminal), the Remote-SSH status bar (bottom left) still is on the login node.
My question is: is there a way to enter this voltash command inside the Remote-SSH extension?
I found this: https://stackoverflow.com/questions/57780250/does-vscode-remote-support-double-ssh however, I can't enter a server IP as I need to use a command (voltash).

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

Unable to connect to remote jupyter server using the vscode python plugin

To connect to a remote jupyter server started with --no-browser option, I usually do a local port forward and connect to the server using the web-browser. However, I would like to connect to that server using the vscode's python extension using its "Specify Jupyter server URI" option. At present, I tried passing the same url , something like http://127.0.01:8888/notebooks/some_nb.ipynb?token=asd45366778875434.adsdsgd35331, but nothing happens.
How do I connect to this server form within vscode?Any help would be appreciated.