Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Remote-SSH Bug]: Could not establish connection when useExecServer is false #10229

Closed
shiltian opened this issue Sep 5, 2024 · 14 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH verified Verification succeeded

Comments

@shiltian
Copy link

shiltian commented Sep 5, 2024

  • VSCode Version: 1.93.0
  • Local OS Version: macOS 14.6.1
  • Remote OS Version: Ubuntu 22.04.3
  • Remote Extension/Connection Type: Server
  • Logs:
[14:10:07.408] Log Level: 2
[14:10:07.412] VS Code version: 1.93.0
[14:10:07.412] Remote-SSH version: remote-ssh@0.114.0
[14:10:07.412] darwin arm64
[14:10:07.413] SSH Resolver called for "ssh-remote+dev", attempt 1
[14:10:07.413] "remote.SSH.useLocalServer": true
[14:10:07.413] "remote.SSH.useExecServer": false
[14:10:07.413] "remote.SSH.path": undefined
[14:10:07.413] "remote.SSH.configFile": undefined
[14:10:07.413] "remote.SSH.useFlock": true
[14:10:07.413] "remote.SSH.lockfilesInTmp": false
[14:10:07.413] "remote.SSH.localServerDownload": auto
[14:10:07.413] "remote.SSH.remoteServerListenOnSocket": false
[14:10:07.413] "remote.SSH.showLoginTerminal": false
[14:10:07.413] "remote.SSH.defaultExtensions": []
[14:10:07.413] "remote.SSH.loglevel": 2
[14:10:07.413] "remote.SSH.enableDynamicForwarding": true
[14:10:07.413] "remote.SSH.enableRemoteCommand": false
[14:10:07.413] "remote.SSH.serverPickPortsFromRange": {}
[14:10:07.413] "remote.SSH.serverInstallPath": {}
[14:10:07.414] "remote.SSH.permitPtyAllocation": false
[14:10:07.414] "remote.SSH.preferredLocalPortRange: undefined
[14:10:07.414] "remote.SSH.useCurlAndWgetConfigurationFiles: false
[14:10:07.419] SSH Resolver called for host: dev
[14:10:07.419] Setting up SSH remote "dev"
[14:10:07.420] Acquiring local install lock: /var/folders/gt/rdf1gsc11rn0k65kr2l6z94w0000gn/T/vscode-remote-ssh-d55997bc-install.lock
[14:10:07.420] Looking for existing server data file at /Users/shiltian/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d55997bc-4849ca9bdf9666755eb463db297b69e5385090e3-0.114.0-tr/data.json
[14:10:07.421] No existing data file
[14:10:07.421] Using commit id "4849ca9bdf9666755eb463db297b69e5385090e3" and quality "stable" for server
[14:10:07.421] Script variables:
 {
  "InstallExitCode.24": "AlreadyInProgress",
  "InstallExitCode.25": "ServerDownloadFailed",
  "InstallExitCode.26": "NoDownloaderAvailable",
  "InstallExitCode.27": "UnsupportedArch",
  "InstallExitCode.28": "StatusCheckFailed",
  "InstallExitCode.29": "NeedInsidersArch",
  "InstallExitCode.30": "NoDownloaderAvailableForStatusCheck",
  "InstallExitCode.31": "ServerTransferFailed",
  "InstallExitCode.32": "ServerFailedToStart",
  "InstallExitCode.33": "NeedInsidersWindows",
  "InstallExitCode.34": "CreateInstallDirFailed",
  "InstallExitCode.35": "UnsupportedPlatform",
  "InstallExitCode.36": "ServerTerminatedCVE20201416",
  "InstallExitCode.37": "UnpackFailed",
  "InstallExitCode.38": "ChangeDirFailed",
  "InstallExitCode.AlreadyInProgress": "24",
  "InstallExitCode.ServerDownloadFailed": "25",
  "InstallExitCode.NoDownloaderAvailable": "26",
  "InstallExitCode.NoDownloaderAvailableForStatusCheck": "30",
  "InstallExitCode.UnsupportedArch": "27",
  "InstallExitCode.StatusCheckFailed": "28",
  "InstallExitCode.NeedInsidersArch": "29",
  "InstallExitCode.ServerTransferFailed": "31",
  "InstallExitCode.ServerFailedToStart": "32",
  "InstallExitCode.NeedInsidersWindows": "33",
  "InstallExitCode.CreateInstallDirFailed": "34",
  "InstallExitCode.UnsupportedPlatform": "35",
  "InstallExitCode.ServerTerminatedCVE20201416": "36",
  "InstallExitCode.UnpackFailed": "37",
  "InstallExitCode.ChangeDirFailed": "38",
  "InstallUnpackCode.Success": "success",
  "InstallUnpackCode.Error": "error",
  "InstallUnpackCode.MissingFiles": "missingFiles",
  "uuid": "ea8e5fb9df9e",
  "startMarker": "ea8e5fb9df9e: running",
  "commitId": "4849ca9bdf9666755eb463db297b69e5385090e3",
  "quality": "stable",
  "token": "a1aaaaa1-a1a1-1a11-1111-aa1a1a111a11",
  "vscodeAgentFolder": "$HOME/.vscode-server",
  "allowClientDownload": "1",
  "forceClientDownload": "0",
  "cliNameInArchive": "code",
  "ignoreWgetConfigFlag": " --no-config ",
  "ignoreCurlConfigFlag": " --disable ",
  "wgetTriesSegment": "--tries=1",
  "listenArgs": "--on-host=127.0.0.1 --on-port",
  "getDownloadServerStartTrigger": "ea8e5fb9df9e:trigger_server_download",
  "getDownloadServerEndTrigger": "ea8e5fb9df9e:trigger_server_download_end",
  "getProgressDownloading": "ea8e5fb9df9e%%1%%",
  "getProgressInstalling": "ea8e5fb9df9e%%2%%"
}
[14:10:07.423] Install and start server if needed
[14:10:07.424] PATH: /opt/local/bin:/opt/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin://Applications/Topaz Photo AI.app/Contents/Resources/bin:/Library/Apple/usr/bin:/Applications/VMware Fusion.app/Contents/Public:/Users/shiltian/.local/bin
[14:10:07.424] Checking ssh with "ssh -V"
[14:10:07.429] > OpenSSH_9.7p1, LibreSSL 3.3.6

[14:10:07.430] askpass server listening on /var/folders/gt/rdf1gsc11rn0k65kr2l6z94w0000gn/T/vscode-ssh-askpass-a491ad7279ac08fb18c1f0f83df3e7315fe48d97.sock
[14:10:07.431] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/gt/rdf1gsc11rn0k65kr2l6z94w0000gn/T/vscode-ssh-askpass-1afbdc8b546f6ebd81cc39810ead130251055b1b.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","60974","-o","ConnectTimeout=30","dev","bash"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/shiltian/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d55997bc-4849ca9bdf9666755eb463db297b69e5385090e3-0.114.0-tr/data.json"}
[14:10:07.431] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.X92BPOop1U/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper (Plugin).app/Contents/MacOS/Code Helper (Plugin)","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"","VSCODE_SSH_ASKPASS_MAIN":"/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/gt/rdf1gsc11rn0k65kr2l6z94w0000gn/T/vscode-ssh-askpass-a491ad7279ac08fb18c1f0f83df3e7315fe48d97.sock"}
[14:10:07.431] Spawned 44695
[14:10:07.496] > local-server-1> Running ssh connection command: ssh -v -T -D 60974 -o ConnectTimeout=30 dev bash
[14:10:07.497] > local-server-1> Spawned ssh, pid=44702
[14:10:07.500] stderr> OpenSSH_9.7p1, LibreSSL 3.3.6
[14:10:07.506] stderr> OpenSSH_9.7p1, LibreSSL 3.3.6
[14:10:07.596] stderr> debug1: Server host key: ssh-ed25519 SHA256:AxlHrphf9TZz/nMEYzAYEHaN/EEEITyGuIPa5jlaErk
[14:10:07.664] stderr> Authenticated to shiltian-hy07qjcy45 ([172.16.0.7]:22) using "publickey".
[14:10:07.774] stderr> debug1: Server host key: ssh-ed25519 SHA256:nIUC5IWhx7jaGkkb6+yhrl+1tmXLxw/Ya837FjzzN4Q
[14:10:07.889] stderr> Authenticated to mlse-bdc-e193a01 (via proxy) using "publickey".
[14:10:08.108] > ready: ea8e5fb9df9e
[14:10:08.120] > Linux 6.8.0-40-generic #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2
[14:10:08.120] Platform: linux
[14:10:08.130] > /usr/bin/zsh
[14:10:08.130] Parent Shell: zsh
[14:10:08.130] Parent Shell pid: 44695
[14:10:08.143] > 295476
[14:10:08.143] Waiting for pid of spawned 'sh' subshell: '295476'...
[14:10:08.162] stderr> sh: 173: Syntax error: "(" unexpected (expecting "then")
[14:10:08.169] stderr> bash: line 234: syntax error near unexpected token `('
[14:10:08.169] stderr> bash: line 234: `echo "* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and"'
[14:10:08.172] stderr> Transferred: sent 19940, received 4372 bytes, in 0.3 seconds
[14:10:08.172] stderr> Bytes per second: sent 70889.0, received 15543.0
[14:10:08.172] stderr> Killed by signal 1.
[14:10:08.176] > local-server-1> ssh child died, shutting down
[14:10:08.176] Local server exit: 0
[14:10:08.176] Received install output: local-server-1> Running ssh connection command: ssh -v -T -D 60974 -o ConnectTimeout=30 dev bash
local-server-1> Spawned ssh, pid=44702
OpenSSH_9.7p1, LibreSSL 3.3.6
OpenSSH_9.7p1, LibreSSL 3.3.6
debug1: Server host key: ssh-ed25519 SHA256:AxlHrphf9TZz/nMEYzAYEHaN/EEEITyGuIPa5jlaErk
Authenticated to shiltian-hy07qjcy45 ([172.16.0.7]:22) using "publickey".
debug1: Server host key: ssh-ed25519 SHA256:nIUC5IWhx7jaGkkb6+yhrl+1tmXLxw/Ya837FjzzN4Q
Authenticated to mlse-bdc-e193a01 (via proxy) using "publickey".
ready: ea8e5fb9df9e
Linux 6.8.0-40-generic #40~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2
/usr/bin/zsh
295476
sh: 173: Syntax error: "(" unexpected (expecting "then")
bash: line 234: syntax error near unexpected token `('
bash: line 234: `echo "* the Visual Studio Code Server License Terms (https://aka.ms/vscode-server-license) and"'
Transferred: sent 19940, received 4372 bytes, in 0.3 seconds
Bytes per second: sent 70889.0, received 15543.0
Killed by signal 1.
local-server-1> ssh child died, shutting down

[14:10:08.177] Failed to parse remote port from server output
[14:10:08.179] Resolver error: Error: 
	at v.Create (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:501404)
	at t.handleInstallOutput (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:498726)
	at e (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:553139)
	at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
	at async /Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:575383
	at async t.withShowDetailsEvent (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:579059)
	at async /Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:549844
	at async T (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:547895)
	at async t.resolveWithLocalServer (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:549384)
	at async k (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:572515)
	at async t.resolve (/Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:576470)
	at async /Users/shiltian/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.0/out/extension.js:2:844816
[14:10:08.182] ------

Steps to Reproduce:

No extra step needed. Just simply connect to any remote.

@ryanmoon
Copy link

ryanmoon commented Sep 5, 2024

Seeing similar issue, but seeing Unbound variable 'wgetTriesSegment' in script 'linux-exec-server-installer.sh'. in the VSCode GUI

@vs-code-engineering vs-code-engineering bot added the ssh Issue in vscode-remote SSH label Sep 5, 2024
@Redoubts
Copy link

Redoubts commented Sep 5, 2024

As a workaround, Downgrading vscode itself to 1.92.2 works for me https://code.visualstudio.com/updates/v1_92

@shiltian
Copy link
Author

shiltian commented Sep 5, 2024

As a workaround, Downgrading vscode itself to 1.92.2 works for me https://code.visualstudio.com/updates/v1_92

An alternative is to downgrade the plugin to v0.113.1.

@justin39
Copy link

justin39 commented Sep 5, 2024

Looks like an issue with

"remote.SSH.useExecServer": false

and can also be worked around by setting to true

@hawicz
Copy link

hawicz commented Sep 5, 2024

Issue #10208 looks like a similar problem

@joshspicer joshspicer assigned joshspicer and unassigned roblourens Sep 5, 2024
@joshspicer
Copy link
Member

Thanks for opening. It looks like I missed a case when useExecServer is disabled. Likely setting useExecServer to true (the default value) will solve this issue on the latest release, or of course downgrading. Apologies for the inconvenience, looking into a fix now.

@shiltian
Copy link
Author

shiltian commented Sep 5, 2024

IIRC the reason I have useExecServer set to `false is to work around a previous issue (which might have been fixed). Lol.

@joshspicer
Copy link
Member

Yes, that's likely :) The useExecServer mode will eventually be the only option, though disabling it is still possible to allow various workarounds. Please do try it enabled, hopefully your original problem has been solved

@joshspicer joshspicer changed the title [Remote-SSH Bug]: Could not establish connection [Remote-SSH Bug]: Could not establish connection when useExecServer is false Sep 5, 2024
@shiltian
Copy link
Author

shiltian commented Sep 5, 2024

Yes, setting it back to default does resolve the original issue. Thx.

@joshspicer
Copy link
Member

Thank you for trying again and letting me know @shiltian

@ryanmoon
Copy link

ryanmoon commented Sep 5, 2024

Setting useExecServer to true doesn't seem to resolve this, I'll downgrade the extension and wait for a fix.

@joshspicer
Copy link
Member

joshspicer commented Sep 5, 2024

Apologies @ryanmoon, your error message was different but I still think i've addressed it in the latest pre-release and am tracking it in #10231.

For others, I believe v0.115.2024090521 (pre-release) should also help (with useExecServer on or off). Please let me know.

@joshspicer joshspicer added the bug Issue identified by VS Code Team member as probable bug label Sep 5, 2024
@joshspicer joshspicer added this to the September 2024 milestone Sep 5, 2024
@joshspicer
Copy link
Member

Release patch version v0.114.1 fixes this issue. Please do comment if the issues continues to persist after upgrading

@leon-v
Copy link

leon-v commented Sep 21, 2024

I run an Ubuntu server where multiple VSCode users SSH remote into, and they all use the ubutnu user for development. Previously, we used this config to keep our settings and extension separate:

"remote.SSH.serverInstallPath": {
    "server-name":"~/.vscode-username"
}

However, we all also had VSCode stall on "Downloading VSCode Server". Around the same time, I also noticed that the ~ in the remote.SSH.serverInstallPath value was taken literally, and a directory named ~ was added to the home folder, so this was the new path: /home/ubuntu/~/.vscode-username/.vscode-server

We set "remote.SSH.useExecServer": false to fix this, however, I noticed that I could connect to other users' VSCode server instances / shells and read sensitive environment variables passed through from VSCode. Users also displayed odd behaviour as they inadvertently shared shells.

I hypothesized that the root cause was how VSCode managed the relative path, so I tried a few things.

Ultimately, I found that using $HOME instead of ~ fixed both my problems. I am now able to connect to the host with "remote.SSH.useExecServer": true or leave it omitted, and use:

"remote.SSH.serverInstallPath": {
    "server-name":"$HOME/.vscode-username"
}

VSCod server installed first try with no issues, and my install path is the expected:

/home/ubuntu/.vscode-username/.vscode-server

Everything seems to work correctly for me now.

@amunger amunger added the verified Verification succeeded label Sep 26, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug ssh Issue in vscode-remote SSH verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants