VSCode Remote SSH安装脚本报错,无法连接Ubuntu服务器
解决VSCode Remote SSH连接Ubuntu时的"Resolver error: Error: Got bad result from install script"问题
问题描述
格式化系统后,使用VSCode Remote SSH连接Ubuntu服务器时出现报错:Resolver error: Error: Got bad result from install script,无法建立连接。Windows账号为管理员账号,可访问cmd.exe,相关日志如下:
[08:44:15.195] Log Level: 2 [08:44:15.268] SSH Resolver called for "ssh-remote+45.136.6.14", attempt 1 [08:44:15.270] "remote.SSH.useLocalServer": false [08:44:15.271] "remote.SSH.showLoginTerminal": false [08:44:15.272] "remote.SSH.remotePlatform": {} [08:44:15.272] "remote.SSH.path": undefined [08:44:15.273] "remote.SSH.configFile": undefined [08:44:15.273] "remote.SSH.useFlock": true [08:44:15.274] "remote.SSH.lockfilesInTmp": false [08:44:15.274] "remote.SSH.localServerDownload": auto [08:44:15.274] "remote.SSH.remoteServerListenOnSocket": false [08:44:15.275] "remote.SSH.showLoginTerminal": false [08:44:15.275] "remote.SSH.defaultExtensions": [] [08:44:15.275] "remote.SSH.loglevel": 2 [08:44:15.276] "remote.SSH.enableDynamicForwarding": true [08:44:15.277] "remote.SSH.enableRemoteCommand": false [08:44:15.277] "remote.SSH.serverPickPortsFromRange": {} [08:44:15.277] "remote.SSH.serverInstallPath": {} [08:44:15.421] VS Code version: 1.76.1 [08:44:15.422] Remote-SSH version: remote-ssh@0.98.0 [08:44:15.422] win32 x64 [08:44:15.427] SSH Resolver called for host: 45.136.6.14 [08:44:15.427] Setting up SSH remote "45.136.6.14" [08:44:15.442] Using commit id "5e805b79fcb6ba4c2d23712967df89a089da575b" and quality "stable" for server [08:44:15.480] Install and start server if needed [08:44:17.521] Checking ssh with "C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe -V" [08:44:17.528] Got error from ssh: spawn C:\Program Files (x86)\Common Files\Oracle\Java\javapath\ssh.exe ENOENT [08:44:17.529] Checking ssh with "C:\Windows\system32\ssh.exe -V" [08:44:17.533] Got error from ssh: spawn C:\Windows\system32\ssh.exe ENOENT [08:44:17.535] Checking ssh with "C:\Windows\ssh.exe -V" [08:44:17.539] Got error from ssh: spawn C:\Windows\ssh.exe ENOENT [08:44:17.540] Checking ssh with "C:\Windows\System32\Wbem\ssh.exe -V" [08:44:17.543] Got error from ssh: spawn C:\Windows\System32\Wbem\ssh.exe ENOENT [08:44:17.544] Checking ssh with "C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe -V" [08:44:17.548] Got error from ssh: spawn C:\Windows\System32\WindowsPowerShell\v1.0\ssh.exe ENOENT [08:44:17.561] Checking ssh with "C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static\ssh.exe -V" [08:44:17.565] Got error from ssh: spawn C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static\ssh.exe ENOENT [08:44:17.566] Checking ssh with "C:\Program Files (x86)\AMD\ATI.ACE\Core-Static\ssh.exe -V" [08:44:17.570] Got error from ssh: spawn C:\Program Files (x86)\AMD\ATI.ACE\Core-Static\ssh.exe ENOENT [08:44:17.571] Checking ssh with "C:\Program Files\PuTTY\ssh.exe -V" [08:44:17.583] Got error from ssh: spawn C:\Program Files\PuTTY\ssh.exe ENOENT [08:44:17.584] Checking ssh with "C:\Program Files\Git\cmd\ssh.exe -V" [08:44:17.588] Got error from ssh: spawn C:\Program Files\Git\cmd\ssh.exe ENOENT [08:44:17.589] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V" [08:44:17.597] Got error from ssh: spawn C:\Windows\System32\OpenSSH\ssh.exe ENOENT [08:44:17.598] Checking ssh with "C:\Program Files\Microsoft VS Code\bin\ssh.exe -V" [08:44:17.602] Got error from ssh: spawn C:\Program Files\Microsoft VS Code\bin\ssh.exe ENOENT [08:44:17.603] Checking ssh with "C:\Users\Erzincan\AppData\Local\Programs\Python\Python311\Scripts\ssh.exe -V" [08:44:17.611] Got error from ssh: spawn C:\Users\Erzincan\AppData\Local\Programs\Python\Python311\Scripts\ssh.exe ENOENT [08:44:17.617] Checking ssh with "C:\Users\Erzincan\AppData\Local\Programs\Python\Python311\ssh.exe -V" [08:44:17.621] Got error from ssh: spawn C:\Users\Erzincan\AppData\Local\Programs\Python\Python311\ssh.exe ENOENT [08:44:17.622] Checking ssh with "C:\Users\Erzincan\AppData\Local\Microsoft\WindowsApps\ssh.exe -V" [08:44:17.627] Got error from ssh: spawn C:\Users\Erzincan\AppData\Local\Microsoft\WindowsApps\ssh.exe ENOENT [08:44:17.627] Checking ssh with "C:\Windows\System32\OpenSSH\ssh.exe -V" [08:44:17.631] Got error from ssh: spawn C:\Windows\System32\OpenSSH\ssh.exe ENOENT [08:44:17.632] Checking ssh with "C:\Program Files\Git\usr\bin\ssh.exe -V" [08:44:19.309] > OpenSSH_9.2p1, OpenSSL 1.1.1t 7 Feb 2023 [08:44:19.320] Running script with connection command: "C:\Program Files\Git\usr\bin\ssh.exe" -T -D 51027 "45.136.6.14" bash [08:44:19.360] Terminal shell path: C:\Windows\System32\cmd.exe [08:44:23.729] "install" terminal command done [08:44:23.731] Install terminal quit with output: [08:44:23.734] Resolver error: Error: Got bad result from install script at m.Create (c:\Users\Erzincan\.vscode\extensions\ms-vscode-remote.remote-ssh-0.98.0\out\extension.js:1:584388) at t.tryInstall (c:\Users\Erzincan\.vscode\extensions\ms-vscode-remote.remote-ssh-0.98.0\out\extension.js:1:681556) at async c:\Users\Erzincan\.vscode\extensions\ms-vscode-remote.remote-ssh-0.98.0\out\extension.js:1:644041 at async t.withShowDetailsEvent (c:\Users\Erzincan\.vscode\extensions\ms-vscode-remote.remote-ssh-0.98.0\out\extension.js:1:647359) at async t.resolve (c:\Users\Erzincan\.vscode\extensions\ms-vscode-remote.remote-ssh-0.98.0\out\extension.js:1:645091) at async c:\Users\Erzincan\.vscode\extensions\ms-vscode-remote.remote-ssh-0.98.0\out\extension.js:1:720839 [08:44:23.750] ------
已尝试的解决方法
- 删除Ubuntu服务器上的
.vscode-server文件夹 - 重新安装Windows端的VS Code
额外解决办法
- 手动指定SSH路径:打开VSCode设置,搜索
remote.SSH.path,将其设置为C:\Program Files\Git\usr\bin\ssh.exe,避免VSCode自动查找SSH客户端时出现异常。 - 启用登录终端:在VSCode设置中找到
remote.SSH.showLoginTerminal并勾选启用,连接时会弹出终端窗口,手动输入服务器密码或处理身份验证步骤,避免自动安装脚本因交互缺失失败。 - 检查服务器端依赖:登录Ubuntu服务器,执行以下命令安装VSCode Server所需的工具:
sudo apt update && sudo apt install curl wget -y - 手动安装VSCode Server:
- 从日志中提取commit id:
5e805b79fcb6ba4c2d23712967df89a089da575b - 在Ubuntu服务器上依次执行:
mkdir -p ~/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b cd ~/.vscode-server/bin/5e805b79fcb6ba4c2d23712967df89a089da575b wget https://update.code.visualstudio.com/commit:5e805b79fcb6ba4c2d23712967df89a089da575b/server-linux-x64/stable -O vscode-server.tar.gz tar -xzf vscode-server.tar.gz --strip-components=1 - 完成后重启VSCode,重新尝试连接。
- 从日志中提取commit id:
- 验证基础SSH连接:在Windows的cmd中执行
"C:\Program Files\Git\usr\bin\ssh.exe" 45.136.6.14,确认能正常登录服务器,排除SSH本身的连接问题。 - 清理本地扩展缓存:删除Windows下的
C:\Users\Erzincan\.vscode\extensions\ms-vscode-remote.remote-ssh-0.98.0文件夹,然后重新安装Remote-SSH扩展。
内容的提问来源于stack exchange,提问作者Rootzilla
相关产品推荐
相关产品推荐

