vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

[Remote-SSH Bug]: The defaultExtensions setting does not respect the "remote.downloadExtensionsLocally" setting

Open jzyrobert opened this issue 2 years ago • 5 comments

Is there an existing issue for this bug?

  • [X] I have searched the existing issues

Required Troubleshooting Steps

  • [X] I have followed these troubleshooting steps
  • [ ] I have tried both values of the remote.SSH.useLocalServer setting

Connect Locally

It connects successfully

->

No response

Expected Behavior

When having the following settings on the client side:

    "remote.downloadExtensionsLocally": true,
    "remote.SSH.localServerDownload": "always",
    "remote.SSH.defaultExtensions": ["extension"],

And connecting to a server that does not have access to the marketplace, the extension should be downloaded from the client and then installed on the remote host.

Instead, it attempts to connect to the marketplace on the remote side and throws an error. Having "remote.downloadExtensionsLocally": true also set in the remote settings does not help.

Steps To Reproduce

  1. On an internet/marketplace enabled client, set the local settings
    "remote.downloadExtensionsLocally": true,
    "remote.SSH.defaultExtensions": ["extension"],
    "remote.SSH.localServerDownload": "always",
  1. Connect to a remote host that does not have internet/marketplace access
  2. Expect "extension" to be installed correctly
  3. See the error
 > Installing extensions...
 > Error while installing extensions: getaddrinfo EAI_AGAIN marketplace.visualstudio.com
 > getaddrinfo EAI_AGAIN marketplace.visualstudio.com

Remote-SSH Log

Remote-SSH Log (Some identifying info replaced)

[11:45:58.767] Log Level: 2
[11:45:58.785] SSH Resolver called for "ssh-remote+REMOTE", attempt 1
[11:45:58.786] "remote.SSH.useLocalServer": false
[11:45:58.786] "remote.SSH.useExecServer": false
[11:45:58.786] "remote.SSH.showLoginTerminal": false
[11:45:58.786] "remote.SSH.remotePlatform": {"REMOTE":"linux"}
[11:45:58.787] "remote.SSH.path": undefined
[11:45:58.787] "remote.SSH.configFile": undefined
[11:45:58.787] "remote.SSH.useFlock": true
[11:45:58.787] "remote.SSH.lockfilesInTmp": false
[11:45:58.787] "remote.SSH.localServerDownload": always
[11:45:58.787] "remote.SSH.remoteServerListenOnSocket": false
[11:45:58.787] "remote.SSH.showLoginTerminal": false
[11:45:58.788] "remote.SSH.defaultExtensions": ["golang.go"]
[11:45:58.788] "remote.SSH.loglevel": 2
[11:45:58.788] "remote.SSH.enableDynamicForwarding": true
[11:45:58.788] "remote.SSH.enableRemoteCommand": false
[11:45:58.789] "remote.SSH.serverPickPortsFromRange": {}
[11:45:58.789] "remote.SSH.serverInstallPath": {}
[11:45:58.804] VS Code version: 1.82.2
[11:45:58.804] Remote-SSH version: [email protected]
[11:45:58.804] win32 x64
[11:45:58.810] SSH Resolver called for host: REMOTE
[11:45:58.810] Setting up SSH remote "REMOTE"
[11:45:58.828] Using commit id "abd2f3db4bdb28f9e95536dfa84d8479f1eb312d" and quality "stable" for server
[11:45:58.832] Install and start server if needed
[11:45:58.837] Checking ssh with "C:\WINDOWS\CCM\ssh.exe -V"
[11:45:58.841] Got error from ssh: spawn C:\WINDOWS\CCM\ssh.exe ENOENT
[11:45:58.841] Checking ssh with "C:\WINDOWS\system32\ssh.exe -V"
[11:45:58.843] Got error from ssh: spawn C:\WINDOWS\system32\ssh.exe ENOENT
[11:45:58.843] Checking ssh with "C:\WINDOWS\ssh.exe -V"
[11:45:58.845] Got error from ssh: spawn C:\WINDOWS\ssh.exe ENOENT
[11:45:58.845] Checking ssh with "C:\WINDOWS\System32\Wbem\ssh.exe -V"
[11:45:58.847] Got error from ssh: spawn C:\WINDOWS\System32\Wbem\ssh.exe ENOENT
[11:45:58.847] Checking ssh with "C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[11:45:58.848] Got error from ssh: spawn C:\WINDOWS\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[11:45:58.849] Checking ssh with "C:\WINDOWS\System32\OpenSSH\ssh.exe -V"
[11:45:59.317] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[11:45:59.326] Running script with connection command: "C:\WINDOWS\System32\OpenSSH\ssh.exe" -T -D 50129 "REMOTE" bash
[11:45:59.330] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[11:45:59.905] > ]0;C:\WINDOWS\System32\cmd.exe
[11:45:59.905] Got some output, clearing connection timeout
[11:46:12.519] > f01043ab205d: running
[11:46:12.534] > Acquiring lock on /home/USER/.vscode-server/bin/abd2f3db4bdb28f9e95536dfa84d847
> 9f1eb312d/vscode-remote-lock.USER.abd2f3db4bdb28f9e95536dfa84d8479f1eb312d     
> Found existing installation at /home/USER/.vscode-server/bin/abd2f3db4bdb28f9e9
> 5536dfa84d8479f1eb312d...
> Checking /home/USER/.vscode-server/.abd2f3db4bdb28f9e95536dfa84d8479f1eb312d.lo
> g and /home/USER/.vscode-server/.abd2f3db4bdb28f9e95536dfa84d8479f1eb312d.pid for a running server
> Looking for server with pid: 6675
[11:46:12.553] > Found running server... 
> Installing extensions...
[11:46:12.711] > Installing extensions...
[11:46:13.048] > Error while installing extensions: getaddrinfo EAI_AGAIN marketplace.visualstudi
> o.com
[11:46:13.062] > getaddrinfo EAI_AGAIN marketplace.visualstudio.com
[11:46:13.064] > 
> *
> * Visual Studio Code Server
> *
> * By using the software, you agree to
> * the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-lice
> nse) and
> * the Microsoft Privacy Statement (https://privacy.microsoft.com/en-US/privacyst
> atement).
> *
> 
> Checking server status on port 33789 with wget
[11:46:13.077] > f01043ab205d: start
> SSH_AUTH_SOCK====
> DISPLAY====
> webUiAccessToken====
> listeningOn==33789==
> osReleaseId==ubuntu==
> arch==x86_64==
> vscodeArch==x64==
> bitness==64==
> tmpDir==/run/user/1000==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime==524==
> serverStartTime====
> connectionToken==11aa1a1a-11aa-11a1-1aa1-111aa1aaa111==
> f01043ab205d: end
[11:46:13.078] Received install output: 
SSH_AUTH_SOCK====
DISPLAY====
webUiAccessToken====
listeningOn==33789==
osReleaseId==ubuntu==
arch==x86_64==
vscodeArch==x64==
bitness==64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime==524==
serverStartTime====
connectionToken==11aa1a1a-11aa-11a1-1aa1-111aa1aaa111==

[11:46:13.078] Remote server is listening on port 33789
[11:46:13.078] Parsed server configuration: {"serverConfiguration":{"remoteListeningOn":{"port":33789},"osReleaseId":"ubuntu","arch":"x86_64","webUiAccessToken":"","sshAuthSock":"","display":"","tmpDir":"/run/user/1000","platform":"linux","connectionToken":"11aa1a1a-11aa-11a1-1aa1-111aa1aaa111"},"extInstallTime":524,"installUnpackCode":""}
[11:46:13.084] Starting forwarding server. local port 50142 -> socksPort 50129 -> remotePort 33789
[11:46:13.086] Forwarding server listening on port 50142
[11:46:13.086] Waiting for ssh tunnel to be ready
[11:46:13.092] Tunneled port 33789 to local port 50142
[11:46:13.092] Resolved "ssh-remote+REMOTE" to "port 50142"
[11:46:13.095] > 
[11:46:13.096] [Forwarding server port 50142] Got connection 0
[11:46:13.112] ------




[11:46:13.138] [Forwarding server port 50142] Got connection 1
[11:46:13.312] [Forwarding server port 50142] Got connection 2

Anything else?

No response

jzyrobert avatar Oct 10 '23 11:10 jzyrobert

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

vscodenpa avatar Oct 11 '23 23:10 vscodenpa

That's the way the feature is implemented currently- it tries to install the extensions before connecting to your remote, so you don't have to do a reload, but then it can't yet do the download locally

roblourens avatar Oct 11 '23 23:10 roblourens

That's the way the feature is implemented currently- it tries to install the extensions before connecting to your remote, so you don't have to do a reload, but then it can't yet do the download locally

I see, thanks. I wish I could contribute a setting to override this but sadly the extension isn't open source

jzyrobert avatar Oct 12 '23 01:10 jzyrobert

+1 - current implementation kinda defeats the purpose of/negates the remote.downloadExtensionsLocally setting

HunterDG avatar Feb 01 '24 16:02 HunterDG

How do I circumvent this bug? Can I copy/extract extensions to some directory on the remote to install them?

flying-sheep avatar Jun 11 '24 08:06 flying-sheep

@flying-sheep you could use the command shown below to manually install an extension you've copied to your remote machine

Image

On a host that can download extension, you'd find them by default in $HOME/.vscode-server/extensions. Extensions in that form on disk can be installed with the command regardless of internet connectivity

There is a download button for extensions on the marketplace website,or you can take the copy from your local VS Code instance.

joshspicer avatar Dec 16 '24 20:12 joshspicer

@joshspicer In the latest pre-release Remote-SSH extension it now adds a setting called remote.SSH.defaultExtensionsIfInstalledLocally which is non-empty by default:

Image

This then causes connection attempts to remote hosts without Internet access to fail due to the issue raised here. Could you please ship this setting to be empty by default, or at least allow for a fallback if marketplace.visualstudio.com cannot be reached rather than failing the connection and having to remove the entries manually?

Thanks

jzyrobert avatar Jan 16 '25 11:01 jzyrobert

Thanks for the feedback @jzyrobert, I will remove the defaults.

joshspicer avatar Jan 16 '25 18:01 joshspicer

Pada Sel, 17 Des 2024, 03.54, Josh Spicer @.***> menulis:

@flying-sheep https://github.com/flying-sheep you could use the command shown below to manually install an extension you've copied to your remote machine image.png (view on web) https://github.com/user-attachments/assets/502972e0-d57d-44eb-a98e-aff99ae2ea18

On a host that can download extension, you'd find them by default in $HOME/.vscode-server/extensions. Extensions in that form on disk can be installed with the command regardless of internet connectivity

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-remote-release/issues/9090#issuecomment-2546735548, or unsubscribe https://github.com/notifications/unsubscribe-auth/BESOU5LYDZ5XFIWNC4N63PL2F44ZJAVCNFSM6AAAAABTW7KCGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBWG4ZTKNJUHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Aninditastevani avatar Jan 16 '25 19:01 Aninditastevani

unsunsribed

Pada Jum, 17 Jan 2025, 02.22, Anindita Stevani @.***> menulis:

Pada Sel, 17 Des 2024, 03.54, Josh Spicer @.***> menulis:

@flying-sheep https://github.com/flying-sheep you could use the command shown below to manually install an extension you've copied to your remote machine image.png (view on web) https://github.com/user-attachments/assets/502972e0-d57d-44eb-a98e-aff99ae2ea18

On a host that can download extension, you'd find them by default in $HOME/.vscode-server/extensions. Extensions in that form on disk can be installed with the command regardless of internet connectivity

— Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode-remote-release/issues/9090#issuecomment-2546735548, or unsubscribe https://github.com/notifications/unsubscribe-auth/BESOU5LYDZ5XFIWNC4N63PL2F44ZJAVCNFSM6AAAAABTW7KCGCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNBWG4ZTKNJUHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Aninditastevani avatar Jan 16 '25 19:01 Aninditastevani

The latest insiders will automatically do what 'downloadExtensionsLocally' does for 'defaultExtensions' (if they first fail to be installed on the remote)

joshspicer avatar Feb 21 '25 18:02 joshspicer

Testing steps:

  • Set up a remote host that does not have access to the internet. The remote needs to fail to download extensions from the internet to trigger this fallback. - Option 1: Here's a docker configuration that should work as your "remote" machine that you SSH to. - Option 2: Easy way to do this on a linux box is install ufw (uncomplicated firewall) and run the commands:
sudo apt install ufw   # or similar for your distro
sudo ufw status allow 22
sudo ufw default deny outgoing
sudo ufw status verbose # check your firewall rules (make sure you don't block inbound ssh!)

sudo ufw enable
  • Ensure you don't have any extensions cached on your remote by deleting ~/.vscode-server-insiders on your remote machine
  • Add some marketplace extensions to the remote.SSH.defaultExtensions setting
  • Connect to the host with Remote - SSH.
  • Confirm that the extensions eventually appear installed

You'll see similar messages in the window log (please share verbose window log if any issues arise!)

2025-02-24 08:27:03.045 [warning] [Window] Relayed failed extension 'joshspicer.fakefakefake' from server is not found in the gallery
2025-02-24 08:27:03.045 [info] [Window] Downloading the 'joshspicer.touchbarcommandshortcuts' extension locally and install
2025-02-24 08:27:03.291 [info] [Views] Added views:workbench.panel.repl.view in workbench.panel.repl
2025-02-24 08:27:03.568 [info] [Window] Downloaded extension: joshspicer.touchbarcommandshortcuts /Users/jospicer/.vscode-oss-dev/CachedExtensionVSIXs/joshspicer.touchbarcommandshortcuts-0.0.2
2025-02-24 08:27:03.670 [info] [Window] Successfully installed 'joshspicer.touchbarcommandshortcuts' extension

joshspicer avatar Feb 24 '25 20:02 joshspicer