VS Code remote server extension shows "attempting to reconnect" - visual-studio-code

I use Visual Studio Code and RemoteSSH extension to connect to a remote server located across the ocean via the corporate VPN, The connection gets established when I connect via my mobile hotspot, but it keeps showing "Attempting to reconnect" asking for password repeatedly when I use my broadband.
I have compared the internet speed of both the service providers and below are the results.
1)Airtel hotspot(remote ssh works)
2)Hathway broadband(remote ssh does'nt work)
From the above images it is evident that my broadband speed(upload and download) is much better than my internet hotspot speed, In spite of this I am unable to use remote ssh to code using my broadband network, Is there something that needs to be tweaked, or are the internet speed tests in a way inaccurate?

I had similar experience and there are many threads on the subject, none of which resolved it for me.
I am working on a Windows laptop and connecting to remote Centos linux.
I also connect to company network via their VPN.
I resolved it in the following manner, maybe not all steps are required, but this is what I did -but firstly, I setup ssh keys so as not to have to keep using a password, well worth the effort.
Updated the fileWatcher in code to ignore .git folder and venv folder, this improves performance
Updated WSL to WSL2
Install a linux shell on Windows - I was already using an Ubuntu one, installed prior to vscode, but hints online suggested installing it after vscode, so I installed the Kali shell.
Installed openssh-server (to get ssh-keygen) on kali
Launched code from the kali shell, let it do its setup
Even though all extensions were installed on both machine, vscode didn't recognize that and I had to use the option in the extension section to "install exentsions on remote server"
After that, every thing was fine.
Hope that helps anyone else searching this problem.

In Airtel hotspot, your public IP address remains the same.
In case of Hathway broadband, public IP changes very frequently. So, if your VPN is redirecting you over IP, there may be possibility of delay because of authentication verification.

Related

Remote Tunnel stuck at creating VSCode server

I cannot create a new Remote Tunnel on my remote machine.
It previously worked fine but after a reboot, it is now stuck at creating a new code server step.
code tunnel --log trace --cli-data-dir . --verbose
*
* Visual Studio Code Server
*
* By using the software, you agree to
* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and
* the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacystatement).
*
[2023-01-08 16:58:40] debug No code server tunnel found, creating new one
The log in the working directory shows nothing. Please help!
Microsoft failed to mention a tiny detail about VSCode Tunnels which is bringing a myriad of weird problems to the users of this superb VSCode feature:
For VSCode Tunnels to run/connect properly on most Linux users, the Server VScode MUST run as root.
For VSCode Tunnels to run/connect properly on most Windows users, the Server VScode MUST Run As Administrator.
Works flawlessly after that.
Saved me a great ton of troubleshooting all my firewalls (local n remote), UDP port restrictions, OS Settings, "Hidden" VSCode Settings, etc... which I did quite extensively before stumbling upon this universal conclusion.

Visual Studio Code remote access to a WSL2:ubuntu on my desktop from my macbook

've looked around and can't seem to find the answer to this - probably because the feature is pretty new.
I tried the remote WSL:ubuntu connection on my windows desktop machine to connect to my WSL2 Ubuntu running on the same machine. This is pretty much perfect as it allows access to my Nvidia GPU under linux
Is there anyway I can do the same trick from my macbook? I can connect to the windows side of the desktop using the new remote tunnel feature but I'm drawing a blank on how to do for the WSL buried in that machine. It looks like it's just using the same remote connection feature so I'm thinking it should be possible but WSL2 network is not exposed the same way you can with a VM or other machine.
The desktop has way more everything than my macbook including a nvidia GPU I want to use for some machine learning.
I can do it from the desktop itself - but it's nice to be able to use that machine from my macbook at certain times of day.
I have recently started using VSCode so I'm on the learning curve with it - it may well be that it's not possible using the new remote tunnels - or requires some messing with adding a new hyper-v bridged adapter to the WSL installation. I'm hoping against hope there's an easy solve that I've somehow missed.
I tried setting up the remote tunnel as per https://code.visualstudio.com/blogs/2022/12/07/remote-even-better but it seems to setup a server to access windows not the WSL2 service.
Thanks for any help!
I had a similar problem and found this github issue. While the developers are looking into including this feature, you currently will need to install the VSCode CLI directly in WSL. You can find the downloads here
Notes
I would recommend the x64 CLI download in the Linux section. It will download a tar.gz file which will have a file named code in it when extracted.
The tunnel will launch from wherever you place that code file, so I put mine in the ~/ (home) directory.
You can then open a tunnel using the command ./code tunnel from that location. You can replace the . with the path to the code file to open the tunnel while in a different directory, i.e. ~/code.
You can still launch a tunnel from Windows with code tunnel. (note that this command does not have ./)

Remote development with VS Code

I'm running Alpine 3.12 with the latest 64-bit kernel. Installed VS extension for remote server ssh connections and by trying to connect, I see that the process has downloaded a folder ".vscode-server" on my remote server, which means that the connection happened, but after loading for some time I receive this message "The remote host may not meet VS Code Server's prerequisites for glibc and libstdc++". I did some googling on this, and I see that a few people were having trouble as they didn't have enough space on their server storage to install some libraries, but this is not the case for me. The extension itself provides me with this link https://code.visualstudio.com/docs/remote/linux#_remote-host-container-wsl-linux-prerequisites explaining that there could be problems for Alpine based systems, but it should work anyways, but I can't quite find the problem. Maybe someone has faced this issue and can guide me to the solution?

Install extensions for remote - ssh when remote machine is behind a proxy

I've installed the Remote - SSH extension to develop while working from home, code that is sitting on a remote work computer. Previously I'd been using VSCode installed on the remote Linux machine and just used NX or some remote desktop software to connect and develop. I note that just to point out that a local version of VSCode is also installed on the machine. Now while home, I first connect my laptop to VPN and then using the Remote - SSH extension I am able to develop code sitting on the remote machine. For this SSH connection, I've installed a few extensions on the remote machine that seem to work fine, but I am having trouble installing or getting others to work. Namely the rust-analyzer extension won't install and the rust extension doesn't work. I assume it is because of the "Known limitations" listed on this page https://code.visualstudio.com/docs/remote/ssh#_managing-extensions where it advices to extensions may not work unless the appropriate environment variables are set. Previously I'd been setting http_proxy and https_proxy but now I also set HTTP_PROXY and HTTPS_PROXY because of this advice. However, setting these variables does not solve the problem. I also set these variables in .wgetrc following advice I found somewhere. If this is a proxy issue, how do I set the correct variable? Also, is there an alternative way to install extensions so that they work via the Remote - SSH extension?
Settings -> "Remote" tab -> search "proxy"
set "Http: Proxy", and then reconnect remote

Visual Studio Code Remote Development using SSH to Raspbian

I want to run Visual Studio Code Remote Development using SSH to my Raspberry Pi 3 Model B+ running Raspbian GNU/Linux 9 (stretch).
I have tried to follow the "Getting started" instructions. I run the command Remote-SSH: Connect to Host..., but I get the message Can't connect to admin#pihole.local: unreachable or not Linux x86_64 (Linux armv7l )
As far as I know, Raspbian is 32 bit. So, does this mean that what I want to achieve is impossible?
I can connect to the Raspberry Pi using ssh on the command line without problems (not password based).
I'm running VS Code insiders on macOS Mojave 10.14.4.
Update 2: As of the 10th of February, x86_64, ARMv7l (AArch32) and ARMv8l (AArch64) are the supported Linux architectures for Remote SSH. It it appears that a glibc based Linux distribution is needed to meet certain prerequisites/dependencies. There is also experimental support for Windows 10/Windows Server 2016/2019 in the Insiders builds. More information can be found on the prerequisites information page.
Update: As of the 12th of June, approximately one month after my answer to this, support was added for the Raspberry Pi 3. There is no support for other ARM architectures yet, and this does not work with the Raspberry Pi Zero W yet, but I'm not sure about the Raspberry Pi 1 or 2. One point to note at present is that you need to setup public key authentication so you have passwordless login, otherwise you'll need to enter your Raspberry Pi's password multiple times, and it will ultimately fail. Also, as mentioned in a comment, if you've tried the 'stable' Remote Development extensions and found out they didn't work... you need to make sure you remove them from both VSCode AND your Raspberry Pi... else it really won't work. This is also mentioned in the Github issue.
Because of how the Remote SSH function actually work, when you connect to your SSH host, the Remote SSH extension provisions the so-called VS Code Server to that host, so the VS Code Server has to be able to run in your remote environment. Consequently, at present, each architecture may need different implementations or tweaks, before it will be considered 'supported'. At the time of writing, there are no armv7l builds, but this recently changed. We're still early days for this useful looking functionality... but things are changing quickly... There is no Windows or MacOS SSH host support at present... but this may not be the case in another months time.
There is an issue open on GitHub on this topic, so it may be worth keeping an eye on it or subscribing to it to see if/when support is added.