打开终端日志信息会发现如下错误:
Updating VS Code Server to version da15b6fd3ef856477bf6f4fb29ba1b7af717770d
Removing previous installation...
Installing VS Code Server for x64 (da15b6fd3ef856477bf6f4fb29ba1b7af717770d)
Downloading: 100%
/usr/bin/gzip: 1: �ELF����: not found
/usr/bin/gzip: 3: ���: not found
/usr/bin/gzip: 4: Syntax error: "(" unexpected
tar: Child returned status 2
tar: Error is not recoverable: exiting now
tar is unable to read /home/deradmin/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d-1652216065.tar.gz. Either the file is corrupt or tar has an issue.
There's a known WSL issue with tar on Ubuntu 19.10.
See workaround in #1856.
Reload the window to initiate a new server download.
导致原因是WSL版本的问题,需要从WSL1切换到WSL2。解决办法如下:
1、切换版本,参考自链接:
wsl -l -v
wsl --set-default-version 2
wsl --set-version Ubuntu-22.04 2 #will set your Ubuntu 22.04 distribution to use WSL 2
2.更新WSL2系统,下载完成后进行安装,参考链接
下载地址:Manual installation steps for older versions of WSL | Microsoft Docs
3、重启WSL2系统,在Windows的终端运行,参考链接
net stop LxssManager
net start LxssManager
4、在ubuntu系统中启动ssh服务,vscode中的remote-ssh即可连接上