当前位置:   article > 正文

Ubuntu 22.04LTS 使用code.打不开vscode(vscode内Remote-WSL连不上Ubuntu22)已解决(usr/bin/gzip: 1: ELF: not found/us_ubuntu上code .打不开vscode

ubuntu上code .打不开vscode

 

 

具体报错如下:

Installing VS Code Server for x64 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5)
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/rwlinux/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5-1653063762.tar.gz. Either the file is corrupt or tar has an issue.

  1. rwlinux@LAPTOP-8TPVIUOD:~$ code .
  2. Installing VS Code Server for x64 (c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5)
  3. Downloading: 100%
  4. /usr/bin/gzip: 1: ELF: not found
  5. /usr/bin/gzip: 3: : not found
  6. /usr/bin/gzip: 4: Syntax error: "(" unexpected
  7. tar: Child returned status 2
  8. tar: Error is not recoverable: exiting now
  9. tar is unable to read /home/rwlinux/.vscode-server/bin/c3511e6c69bb39013c4a4b7b9566ec1ca73fc4d5-1653063762.tar.gz. Either the file is corrupt or tar has an issue.
  10. There's a known WSL issue with tar on Ubuntu 19.10.
  11. See workaround in https://github.com/microsoft/vscode-remote-release/issues/1856.
  12. Reload the window to initiate a new server download.

原因分析:

Ubuntu22默认用的是wsl2,而之前用的是wsl1

解决办法1如下:

直接在Ubuntu里输入

echo -en '\x10' | sudo dd of=/usr/bin/gzip count=1 bs=1 conv=notrunc seek=$((0x189))

再试试code .打开vscode

如果不行再继续执行下面的步骤!!!!

解决办法2如下:

Step1:用管理员身份打开power shell输入下面指令,发现确实是wsl1的这个问题

wsl -l -v

Step2:转换

先下载下面这个链接,然后点击执行

​​​​​​https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi

然后再powershell里面输入

wsl --set-version Ubuntu-22.04 2

Step3:确保开启虚拟机

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

Step3:输入

wsl --set-default-version 2

Step4:确认

wsl -l -v

完整过程:

转载请申明出处(CSDN小米米小life)

声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop】
推荐阅读
相关标签
  

闽ICP备14008679号