0
Software Version
Client Machine OS Windows 10 x64
Target Machine OS Ubuntu 20.04.4 LTS (GNU/Linux 5.4.0-100-generic x86_64)
VS Code 1.65.0
VS Code Remote - SSH (Stable) 0.76.1

I'm trying to use the Remote SSH extension in VS Code to edit files on a remote server. In C:\Users\me\.ssh\config I have the following host configured:

Host druid 
  HostName mydomain.com
  Port 22
  User myuser
    IdentityFile "K:\PathToKey\id_ed25519"

When trying to connect to this target host, I'm prompted for its OS type, then sometimes the key's password, then it fails. I get the following output:

[21:35:06.080] Log Level: 2
[21:35:06.082] remote-ssh@0.76.1
[21:35:06.082] win32 x64
[21:35:06.091] SSH Resolver called for "ssh-remote+druid", attempt 1
[21:35:06.092] "remote.SSH.useLocalServer": false
[21:35:06.092] "remote.SSH.showLoginTerminal": false
[21:35:06.092] "remote.SSH.remotePlatform": {}
[21:35:06.095] "remote.SSH.path": undefined
[21:35:06.095] "remote.SSH.configFile": undefined
[21:35:06.095] "remote.SSH.useFlock": true
[21:35:06.095] "remote.SSH.lockfilesInTmp": false
[21:35:06.096] "remote.SSH.localServerDownload": auto
[21:35:06.096] "remote.SSH.remoteServerListenOnSocket": false
[21:35:06.096] "remote.SSH.showLoginTerminal": false
[21:35:06.096] "remote.SSH.defaultExtensions": []
[21:35:06.096] "remote.SSH.loglevel": 2
[21:35:06.096] "remote.SSH.enableDynamicForwarding": true
[21:35:06.097] "remote.SSH.enableRemoteCommand": false
[21:35:06.097] "remote.SSH.serverPickPortsFromRange": {}
[21:35:06.097] "remote.SSH.serverInstallPath": {}
[21:35:06.138] SSH Resolver called for host: druid
[21:35:06.138] Setting up SSH remote "druid"
[21:35:06.151] Using commit id "b52...d43" and quality "stable" for server
[21:35:06.155] Install and start server if needed
[21:35:07.663] Checking ssh with "ssh -V"
[21:35:07.709] > OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2

[21:35:07.714] Running script with connection command: ssh -T -D 65124 druid bash
[21:35:07.718] Terminal shell path: C:\Windows\System32\cmd.exe
[21:35:07.955] > ]0;C:\Windows\System32\cmd.exe
[21:35:07.956] Got some output, clearing connection timeout
[21:35:09.262] > /bin/bash: No such file or directory
[21:35:10.541] "install" terminal command done
[21:35:10.542] Install terminal quit with output: ]0;C:\Windows\System32\cmd.exe/bin/bash: No such file or directory
[21:35:10.542] Received install output: ]0;C:\Windows\System32\cmd.exe/bin/bash: No such file or directory
[21:35:10.543] Failed to parse remote port from server output
[21:35:10.544] Resolver error: Error: 
    at Function.Create (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.1\out\extension.js:1:586041)
    at Object.t.handleInstallOutput (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.1\out\extension.js:1:584693)
    at Object.t.tryInstall (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.1\out\extension.js:1:681846)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.1\out\extension.js:1:644486
    at async Object.t.withShowDetailsEvent (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.1\out\extension.js:1:647831)
    at async Object.t.resolve (c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.1\out\extension.js:1:645565)
    at async c:\Users\me\.vscode\extensions\ms-vscode-remote.remote-ssh-0.76.1\out\extension.js:1:722872
[21:35:10.550] ------

I believe these lines in particular point to the root of the problem:

[21:35:07.714] Running script with connection command: ssh -T -D 65124 druid bash
[21:35:07.718] Terminal shell path: C:\Windows\System32\cmd.exe
[21:35:07.955] > ]0;C:\Windows\System32\cmd.exe
[21:35:07.956] Got some output, clearing connection timeout
[21:35:09.262] > /bin/bash: No such file or directory
[21:35:10.541] "install" terminal command done
[21:35:10.542] Install terminal quit with output: ]0;C:\Windows\System32\cmd.exe/bin/bash: No such file or directory
[21:35:10.542] Received install output: ]0;C:\Windows\System32\cmd.exe/bin/bash: No such file or directory

It looks like the code or script of the plugin is trying to run /bin/bash (on the client machine?), but it's using cmd.exe to do so unsuccessfully. I've tried every workaround I could find, but none have worked so far. For reference, I've tried:

  • Switching remote.SSH.useLocalServer between true and false in
    C:\Users\me\AppData\Roaming\Code\User\settings.json
  • Pointing a "PATH" value to C:\Program Files\Git\usr\bin, C:\Program Files\Git\bin, or nothing at all ("") in the terminal.integrated.shell.windows and terminal.integrated.shell.linux settings in my VS Code settings.json, hoping it would pick up bash.exe, or at least override something incorrectly set elsewhere
  • Setting the default terminal profile to either Git Bash or Ubuntu (WSL)
  • Specifying an absolute path to both the ssh executable and the config file in Remote.SSH settings
  • Running ssh -T -D 65124 druid bash in a PowerShell terminal to compare with Remote SSH output (gives one line: /bin/bash: No such file or directory)
  • Running ldd /bin/bash on both the target machine and in an Ubuntu WSL terminal to compare output (identical)
  • Checking home directories for a .vscode-server directory to delete and regenerate, as suggested here
  • Running Remote-SSH: Kill VS Code Server on Host... in the VS Code Command Palette on client machine, which may or may not do the same thing as the solution above
  • Uninstalling and reinstalling the Remote SSH VS Code extension

I was hoping that I'd figure it out in the process of writing this all down and retracing my steps, but I'm still at a loss. Any advice would be much appreciated!

Ben H
  • 1
  • 2
  • Your command is `ssh -T -D 65124 druid bash`. So your client system listens on port 65124, its hostname is druid. Remove the bash there. Once you specify which user to connect with (could be done with `user@druid` btw), the default shell of that user will be launched by the client system, no need to tell it. And you do not need the `-T` I think. Just do `ssh -D 65124 user@druid` and see. – Nic3500 Mar 04 '22 at 04:58
  • @Nic3500 Unfortunately that is the command the VS Code extension is running, and I'm not aware of any way to change it. It seems to be picking up all of my parameters in the ```C:\Users\me\.ssh\config``` file without issue, though. Running something like ```ssh -i "K:\PathToKeyFile" user@druid``` in a standalone terminal works fine. I don't know for sure what the ```-T``` and ```-D``` flags do, but they are added to the command by the extension as well. – Ben H Mar 04 '22 at 05:43

0 Answers0