标题目录
问题描述
电脑关机打开后,使用VSCode连接服务器,在输入完密码之后右下角一直没有加载完毕,一直报:
无法安装VS Code服务器
Windows终端可以ssh到服务器上;VSCode连接时报错,之前连接过。
具体报错信息
[08:47:41.235] Log Level: 1
[08:47:41.244] remote-ssh@0.62.0
[08:47:41.244] win32 x64
[08:47:41.246] SSH Resolver called for "ssh-remote+mrevowgp1.westus2.cloudapp.azure.com", attempt 1
[08:47:41.246] "remote.SSH.useLocalServer": false
[08:47:41.247] "remote.SSH.showLoginTerminal": false
[08:47:41.247] "remote.SSH.remotePlatform": {"mrevowcpu2.centralus.cloudapp.azure.com":"linux"}
[08:47:41.247] "remote.SSH.sshPath": undefined
[08:47:41.247] "remote.SSH.sshConfigurationFile": undefined
[08:47:41.247] "remote.SSH.useFlock": true
[08:47:41.248] "remote.SSH.lockfilesInTmp": false
[08:47:41.248] "remote.SSH.localServerDownload": auto
[08:47:41.248] "remote.SSH.remoteServerListenOnSocket": false
[08:47:41.248] "remote.SSH.showLoginTerminal": false
[08:47:41.248] "remote.SSH.maxReconnectionAttempts": 9007199254740991
[08:47:41.248] SSH Resolver called for host: mrevowgp1.westus2.cloudapp.azure.com
[08:47:41.249] Setting up SSH remote "mrevowgp1.westus2.cloudapp.azure.com"
[08:47:41.279] Using commit id "ea3859d4ba2f3e577a159bc91e3074c5d85c0523" and quality "stable" for server
[08:47:41.285] Install and start server if needed
[08:47:45.967] Checking ssh with "ssh -V"
[08:47:46.028] > OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5
[08:47:46.034] Running script with connection command: ssh -T -D 57263 "mrevowgp1.westus2.cloudapp.azure.com" bash
[08:47:46.037] Terminal shell path: C:\WINDOWS\System32\cmd.exe
[08:47:47.021] "install" terminal received data: "�[2J�[m�[H93ea2fea3716: running
�]0;C:\WINDOWS\System32\cmd.exe��[?25h"
[08:47:47.022] Got some output, clearing connection timeout
[08:47:47.061] "install" terminal received data: "Acquiring lock on /home/mrevow/.vscode-server/bin/ea3859d4ba2f3e577a159bc91e3074
c5d85c0523/vscode-remote-lock.mrevow.ea3859d4ba2f3e577a159bc91e3074c5d85c0523
Found existing installation at /home/mrevow/.vscode-server/bin/ea3859d4ba2f3e577
a159bc91e3074c5d85c0523...�[K
Checking /home/mrevow/.vscode-server/.ea3859d4ba2f3e577a159bc91e3074c5d85c0523.l
og and /home/mrevow/.vscode-server/.ea3859d4ba2f3e577a159bc91e3074c5d85c0523.pid
for a running server�[K
Looking for server with pid: 4605�[K"
[08:47:47.076] "install" terminal received data: "Found running server...�[K
�[K
*�[K
* Reminder: You may only use this software with Visual Studio family products,
* as described in the license (https://go.microsoft.com/fwlink/?linkid=2077057)
*�[K
�[K
Server did not start successfully. Full server log at /home/mrevow/.vscode-serve
r/.ea3859d4ba2f3e577a159bc91e3074c5d85c0523.log >>>�[K
<<< End of server log�[K
93ea2fea3716: start�[K
exitCode==32==�[K
listeningOn====�[K
osReleaseId==ubuntu==�[K
arch==x86_64==�[K
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
93ea2fea3716: end"
[08:47:47.076] Received install output:
exitCode==32==
listeningOn====
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/run/user/1000==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====
[08:47:47.084] Resolver error: Error: The VS Code Server failed to start
at Function.ServerInstallError (c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:64207)
at c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:62459
at Object.t.handleInstallOutput (c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:63061)
at I (c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:311112)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:309029
at async Object.t.withShowDetailsEvent (c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:403706)
at async Object.t.resolve (c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:312426)
at async c:\Users\mrevow\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:127:110280
[08:47:47.087] TELEMETRY: {"eventName":"resolver","properties":{"outcome":"failure","reason":"ExitCode","exitCodeLabel":"ServerFailedToStart","osReleaseId":"ubuntu","arch":"x86_64","askedPw":"0","askedPassphrase":"0","asked2fa":"0","askedHostKey":"0","remoteInConfigFile":"1","gotUnrecognizedPrompt":"0","dynamicForwarding":"1","localServer":"0"},"measures":{"resolveAttempts":1,"exitCode":32,"retries":1,"timing.totalResolveTime":5832,"timing.preSshTime":4790,"timing.establishSshTime":986,"timing.scriptTime":1040}}
[08:47:47.089] ------
[08:47:47.799] "install" terminal command done
[08:47:47.799] Install terminal quit with output:
解决方法
前期准备
:在做后边的操作之前一定要记得关闭远程
,报错的时候会弹出弹窗或者按ESC
,选择关闭远程
即可。
一,关闭VS Code与远程服务器的连接(不能实现,故这一步可省略)
在VS Code中
ctrl+shift+p
后,在弹出框中输入Remote-SSH:kill VS Code Server on Host
,重新打开对应的远端服务器即可。
选择后右下角会弹出提示框:
在****上终止VS Code服务器
。我们可以打开日志
查看一下:
这样说明,我们目前没有办法断掉连接,也可以搜一下怎么在VS Code中删除服务器文件。
> [20:09:53.053] > kill: 用法:kill [-s 信号声明 | -n 信号编号 | -信号声明] 进程号 | 任务声明 ... 或
> kill -l [信号声明]
[20:09:53.115] > rm: 无法删除"/home/....../.vscode-server/bin/8b617bd08fd9e
> 3fc94d14adb8d358b56e3f72314/.nfs000000000171d4d900000f95": 设备或资源忙
> rm: 无法删除"/home/....../.vscode-server/bin/8b617bd08fd9e
> 3fc94d14adb8d358b56e3f72314/.nfs000000000176c16300000f10": 设备或资源忙
[20:09:53.131] > rm: 无法删除"/home/....../.vscode-server/bin/ee2b180d582a7
> f601fa6ecfdad8d9fd269ab1884/.nfs0000000000bb1e4800000baf": 设备或资源忙
> rm: 无法删除"/home/....../.vscode-server/bin/abd2f3db4bdb2
> 8f9e95536dfa84d8479f1eb312d/.nfs00000000017615b40000115e": 设备或资源忙
[20:09:54.401] "Uninstall VS Code Server" terminal command done
二、在服务器端删除.vscode-sever
1.服务器端删除.vscode-sever,路径一般是
/home/$(usrname)/.vscode-sever
。(无需这一步删除,这个是因为查看了很多尝试的方法)
2.在本地电脑可以通过删除
C:\Users\$(username)\.ssh
路径下known_hosts和config文件里面服务器的相关。
三、清楚插件里面的缓存
Remote-SSH插件里面的缓存还在,使用快捷键:
Ctrl
+,
在搜索框中搜索remote.SSH.remotePlatform
清除远端服务器配置
四、本地重启vscode 重新连接即可
注意
上面的解决方法没有所谓的顺序,可以随意组合,也有可能一种就可以解决问题。
小tips
关于插件正在加载,并且始终无法加载成功(一直处于加载状态),重启VSC、禁用插件、甚至重装VSC都无法解决问题。该问题不定期出现!
给出解决方案:
只需在VSC JSON设置文件(settings.json 文件)中加入以下代码
"telemetry.enableTelemetry": false
重启VSC,即可解决。
解决方法二:
文件路径:C:\Users\feilp\AppData\Roaming\Code\CachedExtensionVSIXs
VScode插件微软官网
VScode插件Github官网
vscode下链接远程服务器安装插件失败、速度慢等解决方法
vscode无法跳转 ctrl+鼠标左键无法跳转
解决VSCode跳转无法生效的问题
vscode 的 commit ID
C/C++插件的intelliSense无法正常使用,需要给服务器端重新安装C/C++插件,具体在服务器端无法在线安装插件,那就需要使用离线的方式安装。
打开settings.json
文件的方法
1.ctrl
+ shift
+ p
调出搜索框
2. 选择你想要设置的文件
Open Workspace Settings 也会打开UI设置界面;
Open User Settings (JSON) 会打开用户设置 settings.json 文件;
Open Workspace Settings (JSON) 会打开工作区设置 settings.json 文件
vscode存在两种设置 settings.json 的方式
User Settings 用户设置: 用户级设置,该用户打开的所有vscode共用这个设置
Workspace Settings 工作区设置: 目录下.vscode 隐藏文件夹,设置文件为.vscode/settings.json,作用于当前工作区或项目,优先级高于用户设置
调整vscode工具栏、菜单栏字体大小
输入Zoom level
即是调整菜单栏的整体字体大小