"bash not found" Connecting to SSH on Alpine
Testing #226689
Remote - SSH v0.114.2024082315
Using one window to run a devcontainer:
{
"dockerFile": "Dockerfile",
"appPort": 1234,
"overrideCommand": false
}
FROM alpine:latest
RUN apk update && apk add openssh libstdc++
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's/AllowTcpForwarding no/AllowTcpForwarding yes/' /etc/ssh/sshd_config
RUN ssh-keygen -A
RUN echo "root:foobar" | chpasswd
EXPOSE 1234
CMD ["/usr/sbin/sshd", "-D", "-p", "1234"]
Then connecting to the ssh server: root@localhost:1234
Also on Windows:
Apologies @chrmarti, I don't think the pre-release version with the relevant change was released yet when you created this issue. That explains the bash not found error, which is expected up until v0.114.2024082715.
That said, i'm still able to repro some later issue with your dev container example above. For some reason the scp copying step (which copies the binaries from the host to the remote) is getting stuck. Perhaps it's due to the non-standard port, but unsure at the moment. That code wasn't touched, so it may be an existing but you've uncovered for scp!
I'll look into that and report back.
I think my hunch was right.
I've confirmed that my specific alpine VM that i've been testing with still works with v0.114.2024082715 when using the default ssh port (port 22).
I then tried again changing the ssh server port to something else (3001), and got stuck in the same spot as my test against your dev container example.
Traditionally the scp codepath is not as exercised, but in this instance it is. Thanks for the repo steps, i'll take a look at fixing scp.
If you're able to test targetting port 22 please let me know how it goes, otherwise i'll look into fixing the scp path and then I believe that will unblock this scenario 👍
Works for me with the latest version and port 22 on macOS. Waiting for my devbox to become available again to retest on Windows.
Reopening since I still see this on Windows with Remote-SSH v0.114.2024082901 (pre-release):
Log:
[17:05:25.665] Log Level: 2
[17:05:25.673] SSH Resolver called for "ssh-remote+7b22686f73744e616d65223a226c6f63616c686f7374222c2275736572223a22726f6f74227d", attempt 1
[17:05:25.673] "remote.SSH.useLocalServer": false
[17:05:25.673] "remote.SSH.useExecServer": true
[17:05:25.673] "remote.SSH.showLoginTerminal": false
[17:05:25.673] "remote.SSH.remotePlatform": {"dev-server2":"linux","foobar":"windows","win11-server2":"windows"}
[17:05:25.674] "remote.SSH.path": undefined
[17:05:25.674] "remote.SSH.configFile": undefined
[17:05:25.674] "remote.SSH.useFlock": true
[17:05:25.674] "remote.SSH.lockfilesInTmp": false
[17:05:25.674] "remote.SSH.localServerDownload": auto
[17:05:25.674] "remote.SSH.remoteServerListenOnSocket": false
[17:05:25.674] "remote.SSH.showLoginTerminal": false
[17:05:25.674] "remote.SSH.defaultExtensions": []
[17:05:25.674] "remote.SSH.loglevel": 2
[17:05:25.674] "remote.SSH.enableDynamicForwarding": true
[17:05:25.675] "remote.SSH.enableRemoteCommand": false
[17:05:25.675] "remote.SSH.serverPickPortsFromRange": {}
[17:05:25.675] "remote.SSH.serverInstallPath": {}
[17:05:25.675] "remote.SSH.permitPtyAllocation": false
[17:05:25.675] "remote.SSH.preferredLocalPortRange: undefined
[17:05:25.675] "remote.SSH.useCurlAndWgetConfigurationFiles: false
[17:05:25.681] SSH Resolver called for host: root@localhost
[17:05:25.681] Setting up SSH remote "localhost"
[17:05:25.690] VS Code version: 1.93.0-insider
[17:05:25.690] Remote-SSH version: [email protected]
[17:05:25.690] win32 x64
[17:05:25.692] Using commit id "ff7a154d5e5e9034914f0466420f0f1407f0c95e" and quality "insider" for server
[17:05:25.699] 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": "f3734354f722",
"startMarker": "f3734354f722: running",
"commitId": "ff7a154d5e5e9034914f0466420f0f1407f0c95e",
"quality": "insider",
"token": "b740ecf9-94b9-4364-80c3-f35343ad99f6",
"vscodeAgentFolder": "$HOME/.vscode-server-insiders",
"allowClientDownload": "1",
"forceClientDownload": "0",
"cliNameInArchive": "code-insiders",
"ignoreWgetConfigFlag": " --no-config ",
"ignoreCurlConfigFlag": " --disable ",
"wgetTriesSegment": "--tries=1",
"listenArgs": "--on-host=127.0.0.1 --on-port",
"getDownloadServerStartTrigger": "f3734354f722:trigger_server_download",
"getDownloadServerEndTrigger": "f3734354f722:trigger_server_download_end",
"getProgressDownloading": "f3734354f722%%1%%",
"getProgressInstalling": "f3734354f722%%2%%"
}
[17:05:25.702] Install and start server if needed
[17:05:26.930] Checking ssh with "C:\Windows\system32\ssh.exe -V"
[17:05:26.933] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT
[17:05:26.933] Checking ssh with "C:\Windows\ssh.exe -V"
[17:05:26.935] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT
[17:05:26.935] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V"
[17:05:26.937] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT
[17:05:26.937] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V"
[17:05:26.938] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT
[17:05:26.938] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V"
[17:05:26.978] > OpenSSH_for_Windows_8.6p1, LibreSSL 3.4.3
[17:05:26.982] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 55939 "root@localhost" bash
[17:05:26.984] Terminal shell path: C:\Windows\System32\cmd.exe
[17:05:29.349] > The authenticity of host 'localhost (127.0.0.1)' can't be established.
> ED25519 key fingerprint is SHA256:LnFcTYJ+F0MJcwC+xnSRRbOhXr0Obw8R+dns/i4u30c.
> This key is not known by any other names
> Are you sure you want to continue connecting (yes/no/[fingerprint])?]0;C:\Windows\System32\cmd.exe
[17:05:29.349] Got some output, clearing connection timeout
[17:05:29.349] Detected fingerprint confirmation message
[17:05:29.349] Showing fingerprint confirmation dialog
[17:05:31.555] Got fingerprint response: yes
[17:05:31.555] "install" wrote data to terminal: "yes"
[17:05:31.599] > yes
> Warning: Permanently added 'localhost' (ED25519) to the list of known hosts.
> root@localhost's password:
[17:05:31.600] Showing password prompt
[17:05:33.481] Got password response
[17:05:33.481] "install" wrote data to terminal: "******"
[17:05:33.520] >
[17:05:33.538] > sh: bash: not found
> The process tried to write to a nonexistent pipe.
[17:05:34.812] "install" terminal command done
[17:05:34.813] Install terminal quit with output: sh: bash: not found
[17:05:34.813] Received install output: sh: bash: not found
[17:05:34.815] Resolver error: Error: bash not found
at v.Create (c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:501404)
at c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:497960
at t.handleInstallOutput (c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:498648)
at t.tryInstall (c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:616210)
at async c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:575607
at async t.withShowDetailsEvent (c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:578873)
at async k (c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:572487)
at async t.resolve (c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:576284)
at async c:\Users\chrmarti\.vscode-insiders\extensions\ms-vscode-remote.remote-ssh-0.114.2024082901\out\extension.js:2:844405
[17:05:34.818] ------
[17:05:35.212] Opening exec server for ssh-remote+7b22686f73744e616d65223a226c6f63616c686f7374222c2275736572223a22726f6f74227d
[17:05:35.219] Initizing new exec server for ssh-remote+7b22686f73744e616d65223a226c6f63616c686f7374222c2275736572223a22726f6f74227d
[17:05:35.221] Using commit id "ff7a154d5e5e9034914f0466420f0f1407f0c95e" and quality "insider" for server
[17:05:35.223] 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": "d1d3b8ed0242",
"startMarker": "d1d3b8ed0242: running",
"commitId": "ff7a154d5e5e9034914f0466420f0f1407f0c95e",
"quality": "insider",
"token": "0481c75d-321f-4883-ae20-88e36df3f089",
"vscodeAgentFolder": "$HOME/.vscode-server-insiders",
"allowClientDownload": "1",
"forceClientDownload": "0",
"cliNameInArchive": "code-insiders",
"ignoreWgetConfigFlag": " --no-config ",
"ignoreCurlConfigFlag": " --disable ",
"wgetTriesSegment": "--tries=1",
"listenArgs": "--on-host=127.0.0.1 --on-port",
"getDownloadServerStartTrigger": "d1d3b8ed0242:trigger_server_download",
"getDownloadServerEndTrigger": "d1d3b8ed0242:trigger_server_download_end",
"getProgressDownloading": "d1d3b8ed0242%%1%%",
"getProgressInstalling": "d1d3b8ed0242%%2%%"
}
[17:05:35.224] Install and start server if needed
[17:05:35.299] Opening exec server for ssh-remote+7b22686f73744e616d65223a226c6f63616c686f7374222c2275736572223a22726f6f74227d
[17:06:54.148] Running script with connection command: "C:\Windows\System32\OpenSSH\ssh.exe" -T -D 55939 "root@localhost" bash
[17:06:54.150] Terminal shell path: C:\Windows\System32\cmd.exe
[17:06:56.525] > root@localhost's password:]0;C:\Windows\System32\cmd.exe
[17:06:56.525] Got some output, clearing connection timeout
[17:06:56.526] Showing password prompt
Thank you for re-testing. I see now why this is happening on Windows. By default Windows does not use 'local server' mode, causing it to send an ssh command with a hardcoded bash. This would also repro if a user disabled "useLocalServer" mode on their mac or linux machine (though that would need to be done explicitly)
Pre-release published that should resolve this
https://github.com/user-attachments/assets/29edddbc-0569-4da7-890a-fb0643db6e7e