IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 开发工具 -> vscode ssh连接失败 -> 正文阅读

[开发工具]vscode ssh连接失败

windows上使用vscode ssh连接到linux服务器,一直可以正常使用,但是突然就连接失败了,报错一下log

原因是:vscode自己更新了,导致原有的服务器上~/.vscode-server中的文件过期了,如果服务器一直连接外网的,那么vscode会自己下载,如果服务器没有连接外网,就出现了我的情况,一直连接不成功,一直报错下面的信息。

解决方法:
1. 打开服务器网络
2. 手动去下载包上传到服务器(见第二章节)
3. 使用vscode连接虚拟机,如果连接成功,把虚拟机中的~/.vscode-server/bin/* 打包放到服务器上 — 推荐

[08:48:13.513] Server installation process already in progress - waiting and retrying
[08:48:14.517] Running script with connection command: ssh -T -D 58042 "192.168.31.235" bash
[08:48:14.518] Terminal shell path: C:\Windows\System32\cmd.exe
[08:48:14.900] > ]0;C:\Windows\System32\cmd.exe
[08:48:14.900] Got some output, clearing connection timeout
[08:48:14.933] "install" terminal command done
[08:48:14.933] Install terminal quit with output: 
[08:48:15.404] > 741b6048ee5c: running
[08:48:15.469] > Acquiring lock on /home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b
> 1b1725e0679adfb3/vscode-remote-lock.zhangyasheng.c3f126316369cd610563c75b1b1725e
> 0679adfb3
[08:48:15.478] > Installation already in progress...
> If you continue to see this message, you can try toggling the remote.SSH.useFloc
> k setting
> 741b6048ee5c: start
> exitCode==24==
> listeningOn====
> osReleaseId==ubuntu==
> arch==x86_64==
> tmpDir==/run/user/1017==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> 741b6048ee5c: end
[08:48:15.478] Received install output: 
exitCode==24==
listeningOn====
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/run/user/1017==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====

[08:48:15.478] Server installation process already in progress - waiting and retrying
[08:48:16.481] Running script with connection command: ssh -T -D 58042 "192.168.31.235" bash
[08:48:16.482] Terminal shell path: C:\Windows\System32\cmd.exe
[08:48:16.862] > ]0;C:\Windows\System32\cmd.exe
[08:48:16.863] Got some output, clearing connection timeout
[08:48:16.899] "install" terminal command done
[08:48:16.900] Install terminal quit with output: 
[08:48:17.397] > 741b6048ee5c: running
[08:48:17.459] > Acquiring lock on /home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b
> 1b1725e0679adfb3/vscode-remote-lock.zhangyasheng.c3f126316369cd610563c75b1b1725e
> 0679adfb3
[08:48:17.467] > Installation already in progress...
> If you continue to see this message, you can try toggling the remote.SSH.useFloc
> k setting
> 741b6048ee5c: start
> exitCode==24==
> listeningOn====
> osReleaseId==ubuntu==
> arch==x86_64==
> tmpDir==/run/user/1017==
> platform==linux==
> unpackResult====
> didLocalDownload==0==
> downloadTime====
> installTime====
> extInstallTime====
> serverStartTime====
> 741b6048ee5c: end
[08:48:17.468] Received install output: 
exitCode==24==
listeningOn====
osReleaseId==ubuntu==
arch==x86_64==
tmpDir==/run/user/1017==
platform==linux==
unpackResult====
didLocalDownload==0==
downloadTime====
installTime====
extInstallTime====
serverStartTime====

1. 删掉上面加锁的文件

rm -rf /home/zhangyasheng/.vscode-server/bin/c3f126316369cd6105

[09:14:19.014] Log Level: 2
[09:14:19.022] remote-ssh@0.65.7
[09:14:19.022] win32 x64
[09:14:19.045] SSH Resolver called for "ssh-remote+192.168.31.235", attempt 1
[09:14:19.046] "remote.SSH.useLocalServer": false
[09:14:19.046] "remote.SSH.showLoginTerminal": false
[09:14:19.046] "remote.SSH.remotePlatform": {"192.168.31.235":"linux","192.168.15.59":"linux","192.168.31.190":"linux","192.168.31.237":"linux","192.168.15.207":"linux","192.168.15.210":"linux","10.192.76.131":"linux","192.168.15.20":"linux","192.168.15.157":"linux"}
[09:14:19.046] "remote.SSH.path": undefined
[09:14:19.047] "remote.SSH.configFile": undefined
[09:14:19.047] "remote.SSH.useFlock": true
[09:14:19.047] "remote.SSH.lockfilesInTmp": false
[09:14:19.047] "remote.SSH.localServerDownload": auto
[09:14:19.047] "remote.SSH.remoteServerListenOnSocket": false
[09:14:19.047] "remote.SSH.showLoginTerminal": false
[09:14:19.048] "remote.SSH.defaultExtensions": []
[09:14:19.048] "remote.SSH.loglevel": 2
[09:14:19.048] SSH Resolver called for host: 192.168.31.235
[09:14:19.048] Setting up SSH remote "192.168.31.235"
[09:14:19.079] Using commit id "c3f126316369cd610563c75b1b1725e0679adfb3" and quality "stable" for server
[09:14:19.081] Install and start server if needed
[09:14:19.086] Checking ssh with "ssh -V"
[09:14:19.227] > OpenSSH_for_Windows_8.
[09:14:19.227] > 1p1, LibreSSL 3.0.2

[09:14:19.232] Running script with connection command: ssh -T -D 56763 "192.168.31.235" bash
[09:14:19.234] Terminal shell path: C:\Windows\System32\cmd.exe
[09:14:19.567] > ]0;C:\Windows\System32\cmd.exe
[09:14:19.567] Got some output, clearing connection timeout
[09:14:20.120] > 90cd877ed6f4: running
[09:14:20.176] > Acquiring lock on /home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b
> 1b1725e0679adfb3/vscode-remote-lock.zhangyasheng.c3f126316369cd610563c75b1b1725e
> 0679adfb3
[09:14:20.194] > Installing to /home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b1b17
> 25e0679adfb3...
[09:14:20.202] > 90cd877ed6f4%%1%%
[09:14:20.211] > Downloading with wget
[09:14:27.225] > wget download failed
> 失败:连接超时。    
> printenv:
[09:14:27.232] >     LC_MEASUREMENT=zh_TW.UTF-8
>     SSH_CONNECTION=192.168.31.111 56765 192.168.31.235 22
>     LC_PAPER=zh_TW.UTF-8
>     LC_MONETARY=zh_TW.UTF-8
>     LANG=zh_CN.UTF-8
>     LC_NAME=zh_TW.UTF-8
>     XDG_SESSION_ID=32567
>     USER=zhangyasheng
>     PWD=/home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b1b1725e067
> 9adfb3
>     HOME=/home/zhangyasheng
>     SSH_CLIENT=192.168.31.111 56765 22
>     LC_ADDRESS=zh_TW.UTF-8
>     LC_NUMERIC=zh_TW.UTF-8
>     MAIL=/var/mail/zhangyasheng
>     SHELL=/bin/bash
>     SHLVL=2
>     LANGUAGE=zh_CN:zh
>     LC_TELEPHONE=zh_TW.UTF-8
>     VSCODE_AGENT_FOLDER=/home/zhangyasheng/.vscode-server
>     LOGNAME=zhangyasheng
>     DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1017/bus
>     XDG_RUNTIME_DIR=/run/user/1017
>     PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
> :/usr/local/games:/snap/bin
>     LC_IDENTIFICATION=zh_TW.UTF-8
>     LC_TIME=zh_TW.UTF-8
>     _=/usr/bin/printenv
>     OLDPWD=/home/zhangyasheng
> Trigger local server download
> 90cd877ed6f4:trigger_server_download
> platform==linux==
> vscodeArch==x64==
> destFolder==/home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b1b1725
> e0679adfb3==
> 90cd877ed6f4:trigger_server_download_end
> Waiting for client to transfer server archive...
> Waiting for /home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b1b1725
> e0679adfb3/vscode-scp-done.flag and vscode-server.tar.gz to exist
> 
[09:14:27.233] Got request to download on client for {"platform":"linux","arch":"x64","destFolder":"/home/zhangyasheng/.vscode-server/bin/c3f126316369cd610563c75b1b1725e0679adfb3"}
[09:14:27.233] Downloading VS Code server locally...
[09:14:27.509] Resolver error: Error: Running the contributed command: '_workbench.downloadResource' failed.
	at S._executeContributedCommand (d:\software\Microsoft VS Code\resources\app\out\vs\workbench\services\extensions\node\extensionHostProcess.js:84:120745)
	at processTicksAndRejections (internal/process/task_queues.js:93:5)
	at async c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:139384
	at async Object.t.downloadAndCopyToHost (c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:139299)
	at async c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:414617
	at async Object.t.tryInstall (c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:414829)
	at async c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:294918
	at async Object.t.withShowDetailsEvent (c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:406463)
	at async Object.t.resolve (c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:1:295994)
	at async c:\Users\zys\.vscode\extensions\ms-vscode-remote.remote-ssh-0.65.7\out\extension.js:127:110656
[09:14:27.511] ------

2.这里要去下载什么东西

我服务器端无法访问外网,所以我手动下载

  1. 先把~/.vscode-server/bin/下面的文件夹删掉,以触发wget
  2. 用vscode重新ssh
  3. 看到vscode输出download的时候,查看服务器的进程
    ps -ef |grep vscode
    zhangya+ 49922 0.0 0.0 42876 6468 ? S 09:43 0:00 wget --tries=1 --connect-timeout=7 --dns-timeout=7 -nv -O vscode-server.tar.gz https://update.code.visualstudio.com/commit:c3f126316369cd610563c75b1b1725e0679adfb3/server-linux-x64/stable
https://update.code.visualstudio.com/commit:c3f126316369cd610563c75b1b1725e0679adfb3/server-linux-x64/stable
  1. 然后把下载的包解压到服务器~/.vscode-server/bin/*/ , 注意:bin下有一个文件夹,要进去
  2. tar -vxzf vscode-server-linux-x64.tar.gz -C ./
  3. mv vscode-server-linux-x64/* .
  4. 再用vscode连接即可

关闭vscode的自动更新

在这里插入图片描述

  开发工具 最新文章
Postman接口测试之Mock快速入门
ASCII码空格替换查表_最全ASCII码对照表0-2
如何使用 ssh 建立 socks 代理
Typora配合PicGo阿里云图床配置
SoapUI、Jmeter、Postman三种接口测试工具的
github用相对路径显示图片_GitHub 中 readm
Windows编译g2o及其g2o viewer
解决jupyter notebook无法连接/ jupyter连接
Git恢复到之前版本
VScode常用快捷键
上一篇文章      下一篇文章      查看所有文章
加:2021-08-07 12:17:49  更:2021-08-07 12:20:09 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年12日历 -2024/12/22 13:46:58-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码