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.18362
I solved this problem by shutting down wsl
and then restarting it in powershell.
wsl --shutdown
wsl
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 2
If 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-- https://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 https://update.code.visualstudio.com/commit:507ce72a4466fbb27b715c3722558bb15afa9f48/server-linux-x64/stable to /home/username/.vscode- server/bin/507ce72a4466fbb27b715c3722558bb15afa9f48-1624952921.tar.gz
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 2
Then, 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With