当我使用 vscode 扩展 Remote-ssh 连接到我的远程服务器时,我发现 vs 无法在主机中安装 vscoe-server

when i use vscode extension Remote-ssh to connect to my remote server, i found vs cannot install vscoe-server in host

这是 vscode 在主机 vscode 安装 vscode-server 时的日志

我发现它得到了 vscode-server commit id 如下日志:

[13:07:27.334] Using commit id "f80445acd5a3dadef24aa209168452a3d97cc326" and quality "stable" for server

但它没有在 wget 下载中使用这个提交 ID url:

[13:07:28.420] > wget download failed
> https://update.code.visualstudio.com/commit:/server-darwin/stable:
[13:07:27.297] Log Level: 2
[13:07:27.298] remote-ssh@0.74.0
[13:07:27.298] darwin x64
[13:07:27.306] SSH Resolver called for "ssh-remote+devbox", attempt 1
[13:07:27.307] "remote.SSH.useLocalServer": true
[13:07:27.307] "remote.SSH.path": undefined
[13:07:27.308] "remote.SSH.configFile": undefined
[13:07:27.308] "remote.SSH.useFlock": true
[13:07:27.308] "remote.SSH.lockfilesInTmp": false
[13:07:27.308] "remote.SSH.localServerDownload": off
[13:07:27.309] "remote.SSH.remoteServerListenOnSocket": false
[13:07:27.309] "remote.SSH.showLoginTerminal": false
[13:07:27.309] "remote.SSH.defaultExtensions": []
[13:07:27.309] "remote.SSH.loglevel": 2
[13:07:27.310] "remote.SSH.enableDynamicForwarding": true
[13:07:27.310] "remote.SSH.enableRemoteCommand": false
[13:07:27.310] "remote.SSH.serverPickPortsFromRange": {}
[13:07:27.310] "remote.SSH.serverInstallPath": {}
[13:07:27.325] SSH Resolver called for host: devbox
[13:07:27.325] Setting up SSH remote "devbox"
[13:07:27.330] Acquiring local install lock: /var/folders/8f/x1b597tj715cn0x95bjqmy1m0000gp/T/vscode-remote-ssh-c4ea1055-install.lock
[13:07:27.333] Looking for existing server data file at /Users/bytedance/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-c4ea1055-f80445acd5a3dadef24aa209168452a3d97cc326-0.74.0/data.json
[13:07:27.334] Using commit id "f80445acd5a3dadef24aa209168452a3d97cc326" and quality "stable" for server
[13:07:27.340] Install and start server if needed
[13:07:27.344] PATH: /Users/bytedance/.yarn/bin:/Users/bytedance/.config/yarn/global/node_modules/.bin:/Users/bytedance/.nvm/versions/node/v14.15.1/bin:/Users/bytedance/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/puppetlabs/bin:/Library/Apple/usr/bin:/Applications/Mplus
[13:07:27.345] Checking ssh with "ssh -V"
[13:07:27.359] > OpenSSH_8.6p1, LibreSSL 2.8.3

[13:07:27.369] askpass server listening on /var/folders/8f/x1b597tj715cn0x95bjqmy1m0000gp/T/vscode-ssh-askpass-efdbcc89680acf75582ff2c0e6d258ff60bbf93f.sock
[13:07:27.369] Spawning local server with {"serverId":1,"ipcHandlePath":"/var/folders/8f/x1b597tj715cn0x95bjqmy1m0000gp/T/vscode-ssh-askpass-340d49ea7f83ee5441ed6e4eecae6d815a8c993e.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","63970","-o","ConnectTimeout=15","devbox"],"serverDataFolderName":".vscode-server","dataFilePath":"/Users/bytedance/Library/Application Support/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-c4ea1055-f80445acd5a3dadef24aa209168452a3d97cc326-0.74.0/data.json"}
[13:07:27.370] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/Users/bytedance/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/Applications/Visual Studio Code.app/Contents/MacOS/Electron","VSCODE_SSH_ASKPASS_EXTRA_ARGS":"--ms-enable-electron-run-as-node","VSCODE_SSH_ASKPASS_MAIN":"/Users/bytedance/.vscode/extensions/ms-vscode-remote.remote-ssh-0.74.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/var/folders/8f/x1b597tj715cn0x95bjqmy1m0000gp/T/vscode-ssh-askpass-efdbcc89680acf75582ff2c0e6d258ff60bbf93f.sock"}
[13:07:27.371] Spawned 14057
[13:07:27.515] > local-server-1> Spawned ssh, pid=14064
[13:07:27.520] stderr> OpenSSH_8.6p1, LibreSSL 2.8.3
[13:07:27.596] stderr> debug1: Server host key: ecdsa-sha2-nistp256 SHA256:b+9mK6ATDvqmXeFeXiRzqh4iICIEtuNptAfPeSuV4sI
[13:07:27.953] stderr> Authenticated to 10.227.84.41 ([10.227.84.41]:22).
[13:07:28.012] > Linux n227-084-041 4.14.81.bm.15-amd64 #1 SMP Debian 4.14.81.bm.15 Sun Sep 8 05:02:31 UTC 2019 x86_64
> 
> The programs included with the Debian GNU/Linux system are free software;
> the exact distribution terms for each program are described in the
> individual files in /usr/share/doc/*/copyright.
> 
> Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
> permitted by applicable law.
[13:07:28.023] > ready: f8c7ecb7b7c3
[13:07:28.033] > Linux 4.14.81.bm.15-amd64 #1 SMP Debian 4.14.81.bm.15 Sun Sep 8 05:02:31 UTC 2019
[13:07:28.034] Platform: linux
[13:07:28.046] stderr> bash: line 1: syntax error near unexpected token `done'
[13:07:28.046] stderr> bash: line 1: `done'
[13:07:28.048] > Installing to ...
[13:07:28.048] stderr> zsh: parse error near `}'
[13:07:28.051] > f8c7ecb7b7c3%%1%%
[13:07:28.051] stderr> do_host_download:1: command not found: millis
[13:07:28.054] > Downloading with wget
[13:07:28.420] > wget download failed
> https://update.code.visualstudio.com/commit:/server-darwin/stable:
> 2022-02-23 13:07:30 ERROR 404: Not Found.

我从今天早上开始也遇到了这个问题,对我来说奇怪的是我可以毫无问题地从终端 SSH 到目标主机。

经过一些调试,似乎 Remote - SSH 扩展引起了问题。以下两个选项对我有用。或者:

  1. 将扩展降级到 0.70.0 对我有用。当前版本(截至目前为 0.74.0)是两天前更新的,我认为这次更新引起了麻烦。

  2. 如果您想保留当前版本,那么关闭 remote.ssh.useLocalServer 也可以。如果您使用的是 mac,请转到代码 > 首选项 > 设置 (Cmd + ,),然后键入 remote.ssh.useLocalServer,它会显示已打开的选项默认开启。关闭它对我也有用。