Remote-SSH VS Code won't use local server despite settings ("remote.SSH.localServerDownload": "always")

I’m experiencing a frustrating issue with the Remote-SSH extension of Visual Studio Code. Here’s my situation:

I’m trying to connect to a remote server via SSH using VS Code (with the Remote-SSH extension). My remote server does not have internet access, so it cannot automatically download the VS Code server.

To work around this, I’ve already set the following parameter in my settings.json file:

"remote.SSH.localServerDownload": "always"

I’ve also manually downloaded the VS Code server on my local machine (which has internet access) and transferred it to my remote server via SCP. I extracted the files into ~/.vscode-server/ on the remote server.

Despite all this, VS Code still displays “Downloading VS Code server…” when I try to connect, and it seems to completely ignore the parameter I configured to force the use of the local server.

What I’ve Tried

  • I’ve double-checked the path of the transferred files to ensure they are correctly placed in the ~/.vscode-server/ directory.
  • I restarted VS Code and the SSH service on the server.
  • I deleted the ~/.vscode-server folder and repeated the file transfer and extraction process.

What I Expected

I expected VS Code to detect the server files that I had previously installed locally and connect without attempting to download anything.

What Actually Happens

VS Code continues to attempt downloading the VS Code server despite the configuration and the locally present files. I don’t understand why the remote.SSH.localServerDownload parameter doesn’t seem to work as intended.

If anyone has encountered this issue before or has any suggestions on how to fix it, I’d really appreciate your help! Thanks in advance.

Your issue with the Remote-SSH extension in Visual Studio Code trying to download the VS Code server, even after manually setting it up on a server without internet access, can be quite frustrating. Here are some troubleshooting steps and potential solutions to ensure VS Code uses the local server without trying to download it:

1. Confirm the Correct Version and Directory

  • Check Version Compatibility: Ensure the version of the VS Code server you manually transferred matches the version of VS Code on your local machine. Incompatible versions might prompt VS Code to attempt a download.
  • Directory Structure: Verify that the VS Code server files are correctly placed in ~/.vscode-server/bin/<commit-id> on the remote server, where <commit-id> corresponds to the commit hash of your local VS Code installation. You can find this by running code --version on your local machine and checking the hash in the output.

2. Use the Correct settings.json Parameters

VS Code has a few key parameters related to Remote-SSH configurations. You may have missed setting an alternative parameter, or a different configuration may be more effective:

"remote.SSH.localServerDownload": "off",

This setting prevents any attempts by VS Code to download the server and should rely on the files you’ve placed manually.

3. Update Permissions

If the ~/.vscode-server folder and its subdirectories lack the necessary permissions, VS Code may fail to recognize the server files:

chmod -R 755 ~/.vscode-server

Ensure that the files are readable and executable by the SSH user you’re connecting with.

4. Check Logs for Insight

VS Code provides verbose logging that can help diagnose where it may be defaulting to a download attempt:

  1. Open the Command Palette in VS Code (press Ctrl+Shift+P or Cmd+Shift+P).
  2. Type Remote-SSH: Show Log and review the output log. Look for entries that might indicate why it’s ignoring the preinstalled server.

5. Alternative: Use a Zip Archive for Pre-Installation

As a last resort, try creating a zip archive of the ~/.vscode-server/bin/<commit-id> directory on your local machine, transferring the archive to the remote server, and extracting it directly into ~/.vscode-server/ on the remote. This approach can sometimes help preserve necessary directory structures and configurations.

After implementing these steps, restart your VS Code instance and reconnect to the remote server. The combination of specifying "remote.SSH.localServerDownload": "off", ensuring file permissions, and having the correct VS Code server version should prevent VS Code from attempting further downloads.