I am trying to run a Python project on the WSL (Ubuntu-18.04 distribution) system with VS code. I have the WSL - Remote plugin v0.39.9 installed. When run the command:
code .Receive the error:
/home/username/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390/bin/code: 12: /home/username/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390/bin/code: /home/username/.vscode-server/bin/6ab598523be7a800d7f3eb4d92d7ab9a66069390/node: Exec format error
When I ran inside the VS Code trying to connect to the WSL instance:
Starting VS Code Server inside WSL (Ubuntu-18.04) Extension version: 0.39.9, Windows build: 18362. Multi distro support: enabled. WSL path support: enabled VS Code Server for WSL closed unexpectedly.
This is the information of VS Code:
Version: 1.39.2 (user setup) Commit: 6ab598523be7a800d7f3eb4d92d7ab9a66069390 Date: 2019-10-15T15:35:18.241Z Electron: 4.2.10 Chrome: 69.0.3497.128 Node.js: 10.11.0 V8: 6.9.427.31-electron.0 OS: Windows_NT x64 10.0.18362asked Nov 5, 2019 at 22:10
Jose RodriguezJose Rodriguez
9,42413 gold badges34 silver badges50 bronze badges
6
I solved this problem by shutting down wsl and then restarting it in powershell.
wsl --shutdown wslanswered Sep 13, 2020 at 18:39
DougDoug
13.2k16 gold badges70 silver badges104 bronze badges
5
Can the problem be that you have an outdated VS Code Server on your WSL and have docker (instead of a Linux version) selected as your default WSL distro?
Solution:
1. Open PowerShell and run wsl -l -v And check that an asterisk * indicates that Ubuntu (or other Linux distro) is your default WSL distro.
* Ubuntu-20.04 Running 2 docker-desktop-data Running 2 docker-desktop Running 2If not, run in PowerShell wslconfig /setdefault <Your WSL Linux distro>
2. When you have the correct WSL distro selected, open VSCode, press Ctrl+Shift+P, and type Remote-WSL: New WSL Window. This will update VS Code Server on your WSL Linux distro.
3. code . should now work in WSL
I had a similar problem that occurred after updating VSCode. I recognized it when I tried to open VSCode from Ubuntu and received the following error:
~$ code . Updating VS Code Server to version 507ce72a4466fbb27b715c3722558bb15afa9f48 Removing previous installation... Installing VS Code Server for x64 (507ce72a4466fbb27b715c3722558bb15afa9f48) Downloading: 100% Failed --2021-06-29 10:48:51-- //update.code.visualstudio.com/commit:507ce72a4466fbb27b715c3722558bb15afa9f48/server-linux-x64/stable Resolving update.code.visualstudio.com (update.code.visualstudio.com)... failed: Temporary failure in name resolution. wget: unable to resolve host address ‘update.code.visualstudio.com’ ERROR: Failed to download //update.code.visualstudio.com/commit:507ce72a4466fbb27b715c3722558bb15afa9f48/server-linux-x64/stable to /home/username/.vscode- server/bin/507ce72a4466fbb27b715c3722558bb15afa9f48-1624952921.tar.gzanswered Jun 29, 2021 at 8:28
KotkaKotka
3613 silver badges8 bronze badges
2
I had the same problem, and turns out that I had as default docker-desktop-data. That distro doesn't have a shell environment so you can set the default distro to be docker-desktop instead and avoid installing anything:
C:\> wsl -l -v NAME STATE VERSION * docker-desktop-data Running 2 docker-desktop Running 2 C:\> wsl -s docker-desktop C:\> wsl -l -v NAME STATE VERSION * docker-desktop Running 2 docker-desktop-data Running 2Then, the command executed by the WSL vscode extension will ask for node installed in that wsl and it will fail.
You then realize here that something extra needs to be done and it won't work out-of-the-box. You may select or install your desired wsl using:
and that will take you to the microsoft store. I would recommend installing the Alpine distro that's the lighweight you may find.
answered Dec 8, 2021 at 18:09
SebastianSebastian
4,0052 gold badges39 silver badges41 bronze badges
This works for me too
wsl --shutdown
Then, I reopened my VS and opened my remote folders. This might happen because you abruptly shut down your computer. In my case, I closed my laptop lid while I could still hear the fan.
answered Jun 12 at 1:58
Installing Ubuntu via Microsoft Store may result in version 1. In this case trying to open a remote window may cause to end up with
VS Code Server for WSL closed unexpectedly. Check WSL terminal for more detailsRestart does not help you here. Then check the WSL version.
wsl -l -v # Take a note your distribution name below NAME STATE VERSION * Ubuntu Running 1And if it is 1 try to change it to 2.
wsl --set-default-version 2 wsl --set-version Ubuntu 2 # will set your Ubuntu distribution to use WSL 2It take some time to convert the version. When the process complete remote window opens successully.
answered yesterday
Mx.WolfMx.Wolf
5585 silver badges11 bronze badges