microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.67k stars 293 forks source link

[Remote-SSH Bug]: Unable to use remote ssh, error log: Resolver error: Error: Creating 'sh' subshell timed out #10325

Closed quodlibetor closed 1 month ago

quodlibetor commented 1 month ago

Is there an existing issue for this bug?

Required Troubleshooting Steps

Connect Locally

It connects successfully

When useLocalServer: false ->

Instead of getting an "Resolver error: Error: Creating 'sh' subshell timed out" error I get:

[20:26:45.383] Got some output, clearing connection timeout
[20:26:45.383] Got malformed request to download on client, missing data: {}
[20:26:45.384] Resolver error: Error: Client-side server download failed
    at v.Create (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:501404)
    at /Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:467462
    at async t.tryInstall (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:616125)
    at async /Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:575788
    at async t.withShowDetailsEvent (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:579017)
    at async k (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:572574)
    at async t.resolve (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:576428)
    at async /Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:844803
[20:26:45.386] ------

Expected Behavior

Up until this afternoon I was able to use the remote-ssh extension to log into a coder.com instance.

I can still ssh in fine, and the ssh proxy command that vscode starts works fine, but vscode itself cannot connect.

with "useLocalServer false" I get:

image

and with "useLocalServer true" I get:

image

Steps To Reproduce

I'm not sure. I have been using remote-ssh as my primary development environment since around January and everything has been fine.

The only new thing I did today was decided to try out https://www.cursor.com.

Every time I attempt to connect now I get one of these two errors, depending on the localserver setting.

I have removed all of ~/.vscode, ~/.vscode-server, and the Application Support/Code directory, as well as re-installing vscode by downloading the dmg and overwriting.

Remote-SSH Log

There are no Remote-SSH Logs:

$ ls .vscode-server
".vscode-server": No such file or directory
Local VSCode logs `"remote.SSH.useLocalServer": true`

``` [20:09:53.465] Log Level: 2 [20:09:53.474] SSH Resolver called for "ssh-remote+MYHOST", attempt 1 [20:09:53.474] "remote.SSH.useLocalServer": true [20:09:53.475] "remote.SSH.useExecServer": true [20:09:53.475] "remote.SSH.path": undefined [20:09:53.475] "remote.SSH.configFile": undefined [20:09:53.475] "remote.SSH.useFlock": true [20:09:53.475] "remote.SSH.lockfilesInTmp": false [20:09:53.475] "remote.SSH.localServerDownload": auto [20:09:53.475] "remote.SSH.remoteServerListenOnSocket": false [20:09:53.475] "remote.SSH.showLoginTerminal": false [20:09:53.475] "remote.SSH.defaultExtensions": [] [20:09:53.475] "remote.SSH.loglevel": 2 [20:09:53.475] "remote.SSH.enableDynamicForwarding": true [20:09:53.475] "remote.SSH.enableRemoteCommand": false [20:09:53.475] "remote.SSH.serverPickPortsFromRange": {} [20:09:53.475] "remote.SSH.serverInstallPath": {} [20:09:53.475] "remote.SSH.permitPtyAllocation": false [20:09:53.475] "remote.SSH.preferredLocalPortRange: undefined [20:09:53.475] "remote.SSH.useCurlAndWgetConfigurationFiles: false [20:09:53.482] VS Code version: 1.93.1 [20:09:53.482] Remote-SSH version: remote-ssh@0.114.3 [20:09:53.482] darwin arm64 [20:09:53.483] SSH Resolver called for host: MYHOST [20:09:53.483] Setting up SSH remote "MYHOST" [20:09:53.485] Acquiring local install lock: /var/folders/8y/82qsfljj4v580fr_t_kxfj7w0000gp/T/vscode-remote-ssh-d86f80e6-install.lock [20:09:53.486] Looking for existing server data file at /Users/bwm/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d86f80e6-38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40-0.114.3-es/data.json [20:09:53.486] No existing data file [20:09:53.486] Using commit id "38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40" and quality "stable" for server [20:09:53.487] 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": "696f3d8ff27b", "startMarker": "696f3d8ff27b: running", "commitId": "38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40", "quality": "stable", "token": "111aaa11-1111-1a1a-aaaa-1111111aa1aa", "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": "696f3d8ff27b:trigger_server_download", "getDownloadServerEndTrigger": "696f3d8ff27b:trigger_server_download_end", "getProgressDownloading": "696f3d8ff27b%%1%%", "getProgressInstalling": "696f3d8ff27b%%2%%" } [20:09:53.489] Install and start server if needed [20:09:53.491] PATH: /opt/homebrew/opt/llvm/bin:/Users/bwm/.local/share/zinit/polaris/bin:/Users/bwm/.local/clang/bin:/Users/bwm/.local/bin:/Users/bwm/.cargo/bin:/Users/bwm/.rye/shims:/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:/Library/Apple/usr/bin:/usr/local/sbin:/Users/bwm/.local/share/mise/shims:/Library/Developer/CommandLineTools/usr/bin:/Users/bwm/go/bin:/Users/bwm/Library/Application Support/JetBrains/Toolbox/scripts [20:09:53.491] Checking ssh with "ssh -V" [20:09:53.497] > OpenSSH_9.6p1, LibreSSL 3.3.6 [20:09:53.499] askpass server listening on /var/folders/8y/82qsfljj4v580fr_t_kxfj7w0000gp/T/vscode-ssh-askpass-e7225005e57ce4dfb4de7a58162d8faf48ac78c1.sock [20:09:53.499] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/8y/82qsfljj4v580fr_t_kxfj7w0000gp/T/vscode-ssh-askpass-6e279d5d6e479cf6284321c39e9d9336dbca996a.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","65271","MYHOST"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/bwm/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-d86f80e6-38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40-0.114.3-es/data.json"} [20:09:53.499] Local server env: {"SSH_AUTH_SOCK":"/private/tmp/com.apple.launchd.JISnA0BYuD/Listeners","SHELL":"/bin/zsh","DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/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/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/8y/82qsfljj4v580fr_t_kxfj7w0000gp/T/vscode-ssh-askpass-e7225005e57ce4dfb4de7a58162d8faf48ac78c1.sock"} [20:09:53.500] Spawned 23067 [20:09:53.572] > local-server-1> Running ssh connection command: ssh -v -T -D 65271 MYHOST [20:09:53.574] > local-server-1> Spawned ssh, pid=23078 [20:09:53.579] stderr> OpenSSH_9.6p1, LibreSSL 3.3.6 [20:09:56.330] stderr> debug1: Server host key: ssh-rsa SHA256:si+B00KtMLb8BeiSFzcm+t6EK1ndAmkPgnpYe26X2G8 [20:09:56.330] stderr> Warning: Permanently added 'MYHOST' (RSA) to the list of known hosts. [20:09:56.390] stderr> Authenticated to MYHOST (via proxy) using "none". [20:09:57.442] > ready: 696f3d8ff27b [20:09:57.475] > Linux 6.8.0-1015-aws #16~22.04.1-Ubuntu SMP Mon Aug 19 19:38:17 UTC 2024 [20:09:57.475] Platform: linux [20:09:57.505] > /usr/bin/zsh [20:09:57.505] Parent Shell: zsh [20:09:57.505] Parent Shell pid: 23067 [20:10:02.894] Terminating local server [20:10:02.897] Resolver error: Error: Creating 'sh' subshell timed out at v.Timeout (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:501530) at a (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:563404) at Timeout._onTimeout (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:563372) at listOnTimeout (node:internal/timers:573:17) at process.processTimers (node:internal/timers:514:7) [20:10:02.898] Local server exit: 15 [20:10:02.902] ------ ```

Local VSCode logs `"remote.SSH.useLocalServer": false`

``` [20:26:39.414] Log Level: 2 [20:26:39.419] SSH Resolver called for "ssh-remote+coder.bwm", attempt 1 [20:26:39.419] "remote.SSH.useLocalServer": false [20:26:39.419] "remote.SSH.useExecServer": true [20:26:39.419] "remote.SSH.showLoginTerminal": false [20:26:39.419] "remote.SSH.remotePlatform": {} [20:26:39.419] "remote.SSH.path": undefined [20:26:39.419] "remote.SSH.configFile": undefined [20:26:39.419] "remote.SSH.useFlock": true [20:26:39.419] "remote.SSH.lockfilesInTmp": false [20:26:39.419] "remote.SSH.localServerDownload": auto [20:26:39.419] "remote.SSH.remoteServerListenOnSocket": false [20:26:39.419] "remote.SSH.showLoginTerminal": false [20:26:39.419] "remote.SSH.defaultExtensions": [] [20:26:39.419] "remote.SSH.loglevel": 2 [20:26:39.419] "remote.SSH.enableDynamicForwarding": true [20:26:39.419] "remote.SSH.enableRemoteCommand": false [20:26:39.419] "remote.SSH.serverPickPortsFromRange": {} [20:26:39.419] "remote.SSH.serverInstallPath": {} [20:26:39.420] "remote.SSH.permitPtyAllocation": false [20:26:39.420] "remote.SSH.preferredLocalPortRange: undefined [20:26:39.420] "remote.SSH.useCurlAndWgetConfigurationFiles: false [20:26:39.424] VS Code version: 1.93.1 [20:26:39.424] Remote-SSH version: remote-ssh@0.114.3 [20:26:39.424] darwin arm64 [20:26:39.425] SSH Resolver called for host: coder.bwm [20:26:39.425] Setting up SSH remote "coder.bwm" [20:26:39.426] Using commit id "38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40" and quality "stable" for server [20:26:39.427] 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": "e308d073774b", "startMarker": "e308d073774b: running", "commitId": "38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40", "quality": "stable", "token": "1a1aaa1a-11a1-1a11-111a-111a1aa1111a", "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": "e308d073774b:trigger_server_download", "getDownloadServerEndTrigger": "e308d073774b:trigger_server_download_end", "getProgressDownloading": "e308d073774b%%1%%", "getProgressInstalling": "e308d073774b%%2%%" } [20:26:39.428] Install and start server if needed [20:26:42.159] PATH: .. snip my path .. [20:26:42.159] Checking ssh with "ssh -V" [20:26:42.168] > OpenSSH_9.6p1, LibreSSL 3.3.6 [20:26:42.170] Running script with connection command: ssh -T -D 51928 'coder.bwm' sh [20:26:42.170] Generated SSH command: 'ssh -T -D 51928 'coder.bwm' sh << 'EOSSH' ... snip a big shell script ... [20:26:45.383] Got some output, clearing connection timeout [20:26:45.383] Got malformed request to download on client, missing data: {} [20:26:45.384] Resolver error: Error: Client-side server download failed at v.Create (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:501404) at /Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:467462 at async t.tryInstall (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:616125) at async /Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:575788 at async t.withShowDetailsEvent (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:579017) at async k (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:572574) at async t.resolve (/Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:576428) at async /Users/bwm/.vscode/extensions/ms-vscode-remote.remote-ssh-0.114.3/out/extension.js:2:844803 [20:26:45.386] ------ [20:26:45.619] "install" terminal command done [20:26:45.620] Install terminal quit with output: ```

Anything else?

No response

joshspicer commented 1 month ago

Thanks for taking the time to open an issue. Could you speak more to this remote coder instance you're attempting to SSH to? Are you able to directly (outside of this extension) SSH to that instance? If so, could you try directly running the SSH command from your logs (specifically ssh -v MYHOST) and then running sh to see if that shell is on the remote's path.

I'm also curious about the (via proxy) line in your connection. Is that proxy something you or coder are placing in between the connection?

[20:09:53.572] > local-server-1> Running ssh connection command: ssh -v -T -D 65271 MYHOST
[20:09:53.574] > local-server-1> Spawned ssh, pid=23078
[20:09:53.579] stderr> OpenSSH_9.6p1, LibreSSL 3.3.6
[20:09:56.330] stderr> debug1: Server host key: ssh-rsa SHA256:si+B00KtMLb8BeiSFzcm+t6EK1ndAmkPgnpYe26X2G8
[20:09:56.330] stderr> Warning: Permanently added 'MYHOST' (RSA) to the list of known hosts.
[20:09:56.390] stderr> Authenticated to MYHOST (via proxy) using "none".
[20:09:57.442] > ready: 696f3d8ff27b

I'm not too familiar with coder, but I do see that this guide they publish mentioning Remote - SSH was updated ~2 weeks ago, perhaps something relevant has changed on their end: https://coder.com/blog/access-your-vs-code-environment-from-any-device

quodlibetor commented 1 month ago

Thanks for responding!

... yes it was sh. I tried to install shfmt from mvdan/sh and I must have installed both sh and shfmt into my ~/.local/bin. Deleted that and everything is working now 🤦.

I thought that sh was being executed locally, so I didn't debug that on my server.

Running ssh ssh coder.bwm sh <<< 'echo "hello from in $(ps -o comm= -p $$)"' gave me mvdan/sh's help text instead of "hello from in sh".