2024年1月,vscode默认更新到了1.86版本,打开vscode连接服务器连接不上,出现报错:
Failed to parse remote port from server output
Exec server for ssh-remote+xx.xx.xxx.xxx failed: Error
Error opening exec server for ssh-remote+xx.xx.xx.xx: Error
Waiting for server log...
Waiting for server log...
Waiting for server log...
通过vscode输出查看一直显示 Waiting for server log,这里根据commid查看linux服务器中的日志进一步定位问题
[11:11:06.413] > Found existing installation at /root/.vscode-server/bin/05047486b6df5eb8d44b2ecd
> 70ea3bdf775fd937...
> Checking /root/.vscode-server/.05047486b6df5eb8d44b2ecd70ea3bdf775fd937.log and
> /root/.vscode-server/.05047486b6df5eb8d44b2ecd70ea3bdf775fd937.pid for a running
> server
...
通过服务器中的日志查看报错信息,由于linux使用的时centos7系统,很明显vscode新版本要求的glic版本高于本地版本:
# tail -f /root/.vscode-server/.05047486b6df5eb8d44b2ecd70ea3bdf775fd937.log
Warning: Missing GLIBCXX >= 3.4.25! from /usr/lib64/libstdc++.so.6.0.19
Warning: Missing GLIBC >= 2.28! from /usr/lib64/libc-2.17.so
Error: Missing required dependencies. Please refer to our FAQ https://aka.ms/vscode-remote/faq/old-linux for additional information.
# ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
解决办法,关闭vscode的自动更新功能,从官网下载老版本:
1. 关闭vscode的自动更新功能,在设置中搜索update,取消勾线auto update,并将 mode设置成manual
2. 从官网下载稳定版本更新,这里选择1.85版本的更新
下载完成后,关闭vscode,直接安装,安装完成后,删除linux服务器中的 /root/.vscode-server目录,重启vscode即可恢复linux远程连接。