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.61k stars 274 forks source link

Support busybox #1747

Closed mpconte closed 1 week ago

mpconte commented 4 years ago

Steps to Reproduce:

  1. Install remote development extension pack locally on Windows machine
  2. SSH connect to remote host (via publickey authentication)
  3. Receive the following error log on connection:

[16:38:17.406]` remote-ssh@0.47.2 [16:38:17.406] win32 x64 [16:38:17.407] SSH Resolver called for "ssh-remote+192.168.20.161", attempt 1 [16:38:17.407] SSH Resolver called for host: 192.168.20.161 [16:38:17.407] Setting up SSH remote "192.168.20.161" [16:38:17.426] Using commit id "6ab598523be7a800d7f3eb4d92d7ab9a66069390" and quality "stable" for server [16:38:17.427] Testing ssh with C:\Program Files\Git\usr\bin\ssh.exe -V [16:38:17.472] ssh exited with code: 0 [16:38:17.472] Got stderr from ssh: OpenSSH_8.0p1, OpenSSL 1.1.1c 28 May 2019 [16:38:17.474] Using SSH config file "D:\software.ssh\config" [16:38:17.474] Running script with connection command: "C:\Program Files\Git\usr\bin\ssh.exe" -T -D 51931 -F D:\software.ssh\config 192.168.20.161 bash [16:38:17.477] Install and start server if needed [16:38:17.478] Terminal shell path: C:\WINDOWS\System32\cmd.exe [16:38:17.607] > [16:38:17.607] Got some output, clearing connection timeout [16:38:18.074] > bd2a25e802b8: running [16:38:18.265] > bash: line 99: ldd: command not found Missing GLIBC >= 2.17! Found version bd2a25e802b8$$1$$ Acquiring lock on /home/root/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390/vscode-remote-lock.6ab598523be7a800d7f3eb4d9 2d7ab9a66069390 [16:38:18.327] > Installing to /home/root/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390... [16:38:18.351] > SHELL=/bin/sh SSH_CLIENT=192.168.1.88 51933 22 USER=root VSCODE_AGENT_FOLDER=/home/root/.vscode-server PATH=/usr/bin:/bin:/usr/sbin:/sbin MAIL=/var/mail/root PWD=/home/root/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390 HOME=/home/root SHLVL=2 LOGNAME=root SSHCONNECTION=192.168.1.88 51933 192.168.20.161 22 =/usr/bin/printenv OLDPWD=/home/root Neither wget nor curl is installed bd2a25e802b8##26##

[16:38:18.656] "install" terminal command done [16:38:18.656] Install terminal quit with output: bd2a25e802b8##26## [16:38:18.656] Received install output: bd2a25e802b8##26## [16:38:18.656] Neither curl nor wget is installed - can't download the Server [16:38:18.656] Resolver error: Downloading VS Code Server failed - please install either curl or wget on the remote. [16:38:18.657] TELEMETRY: {"eventName":"resolver","properties":{"outcome":"failure","reason":"ExitCode","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","gotUnrecognizedPrompt":"0","remoteInConfigFile":"0"},"measures":{"resolveAttempts":1,"exitCode":26,"retries":1}} [16:38:18.657] ------

Even though wget is indeed installed on the remote machine.

which wget /usr/bin/wget

Does this issue occur when you try this locally?: No Does this issue occur when you try this locally and all extensions are disabled?: Yes

roblourens commented 4 years ago

You also have this problem: bash: line 99: ldd: command not found

Could there be something wrong with the PATH in this environment? What if you run

echo "wget --version" | ssh yourhostname bash

mpconte commented 4 years ago

wget: unrecognized option '--version' BusyBox v1.22.1 (2018-11-05 13:31:17 EST) multi-call binary.

Usage: wget [-c|--continue] [-s|--spider] [-q|--quiet] [-O|--output-document FILE] [--header 'header: value'] [-Y|--proxy on/off] [-P DIR] [-U|--user-agent AGENT] [-T SEC] URL...

The ldd command isn't available on my system either

roblourens commented 4 years ago

Ok, this probably won't work currently with just busybox

SidShetye commented 4 years ago

Would also want busybox supported, especially for embedded devices where ram is tight for VS Code Remote Server.

[12:23:41.816] > sh: bash: not found
[12:23:42.122] "install" terminal command done

IMHO, at least a SCP based fallback would be good i.e. download remotefile.sh locally over scp, and scp it back upon save.

jaelys commented 4 months ago

Is there any hope to solve this suggestion?

joshspicer commented 1 month ago

Would folks interested be able to test with the current pre-release extension? There is an scp-based fallback that, given a read of this issue, may help certain workflows.

davidhoy commented 1 month ago

I just tried, using the latest pre-release "Remote -SSH" extension, to install VS Code Server on a Raspberry Pi 3B running Victron's VenusOS. VenusOS uses BusyBox, which does not correctly handle the installation script. Here is the relevant snippet from the output

[13:26:38.921] > Found existing installation at /home/root/.vscode-server...
> Starting VS Code CLI... "/home/root/.vscode-server/code-b1c0a14de1414fcdaa400695b4db1c0799bc3124" command-shell --cli-data-dir "/home/root/.vscode-server/cli" --on-port --on-host=127.0.0.1 --parent-process-id 4349 &> "/home/root/.vscode-server/.cli.b1c0a14de1414fcdaa400695b4db1c0799bc3124.log" < /dev/null
> printenv:
> main: line 79: printenv: command not found
[13:26:38.938] > main: line 56: 1722619599%N/1000000: division by 0 (error token is "N/1000000")
> Removing old logfile at /home/root/.vscode-server/.cli.b1c0a14de1414fcdaa400695b4db1c0799bc3124.log
[13:26:38.954] > Spawned remote CLI: 4380
[13:26:38.968] > ps: invalid option -- 'p'
> BusyBox v1.31.1 (2024-07-26 13:35:14 UTC) multi-call binary.Usage: ps
> Exec server process not found
> 
[13:26:38.976] > main: line 56: 1722619599%N/1000000: division by 0 (error token is "N/1000000")
> main: line 64: - : syntax error: operand expected (error token is "- ")

Not sure how to trigger the scp-based fallback that you mentioned in your earlier post. Alternatively, if there a manual installation procedure? Any help would be much appreciated.

Regards, David

joshspicer commented 3 weeks ago

Thanks for testing @davidhoy. The scp-fallback should happen automatically if wget/curl fail to fetch the server. That said, looks like you're displaying a different issue. I'm going to get an environment set up and dig more in during this iteration.

joshspicer commented 1 week ago

Tomorrow's (morning Pacific time) pre-release of the extension drops the requirement for bash and as many non-standard features as I could find. The installation script has been heavily refactored to drop this requirement, so please give it a whirl and share how it goes!

I've validated against a clean Alpine install using v1.31.1 of busybox with success. The only things I needed to do out-of-the-box to establish a connection was:

  1. Ensure AllowTcpForwarding was set to yes in the SSHD config (not the default value)
  2. Install libstdc++6, which is a requirement for the VS Code server that is spawned
    • I installed this with apk add --no-cache libstdc++6
joshspicer commented 1 week ago

The work tracked here also explicitly addresses: