Running 'code .' in terminal in wsl produces an error

Viewed 969

I recently installed wsl and running code . in the terminal I get this error:

Updating VS Code Server to version f80445acd5a3dadef24aa209168452a3d97cc326
Removing previous installation...
Installing VS Code Server for x64 (f80445acd5a3dadef24aa209168452a3d97cc326)
Downloading: 100%
Failed
--2022-03-01 20:19:21--  https://update.code.visualstudio.com/commit:f80445acd5a3dadef24aa209168452a3d97cc326/server-linux-x64/stable
Resolving update.code.visualstudio.com (update.code.visualstudio.com)... 40.64.128.224
Connecting to update.code.visualstudio.com (update.code.visualstudio.com)|40.64.128.224|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://az764295.vo.msecnd.net/stable/f80445acd5a3dadef24aa209168452a3d97cc326/vscode-server-linux-x64.tar.gz [following]
--2022-03-01 20:19:25--  https://az764295.vo.msecnd.net/stable/f80445acd5a3dadef24aa209168452a3d97cc326/vscode-server-linux-x64.tar.gz
Resolving az764295.vo.msecnd.net (az764295.vo.msecnd.net)... failed: Temporary failure in name resolution.
wget: unable to resolve host address ‘az764295.vo.msecnd.net’
ERROR: Failed to download https://update.code.visualstudio.com/commit:f80445acd5a3dadef24aa209168452a3d97cc326/server-linux-x64/stable to /home/burbanox/.vscode-server/bin/f80445acd5a3dadef24aa209168452a3d97cc326-1646176740.tar.gz

I need to know how I can solve it to be able to open visual studio code

2 Answers

I managed to find a somewhat orthodox solution

  1. First Open Vscode locally via windows
  2. Go to View in upper section and select "command palette"
  3. Select the option "Remote-WSL: New WSL Window "

I had the exact same issue.

Solution:

  1. Go to the search bar and type "Turn windows features on or off", scroll down to Windows Subsystem for Linux, and uncheck it.

  2. Restart

  3. Go back to "Turn windows features on or off", which can also be located in the control panel, and recheck the box for Windows Subsystem for Linux

  4. Restart

    Now you can open to command prompt and type:

    wsl -l -v #this will verify which version you are running. mine remained the same at wsl 2. if it is not you can change it.
    wsl --set-version Ubuntu20.04 2
    
  5. Open your Ubuntu command line and try retyping (code .) and it should install the proper packages.

    taylor@DESKTOP-TI4J8NI:~/Desktop/OS_Python$ code .                                                                                                             
    Updating VS Code Server to version 3b889b090b5ad5793f524b5d1d39fda662b96a2a                                                                                    
    Removing previous installation...                                                                                                                              
    Installing VS Code Server for x64 (3b889b090b5ad5793f524b5d1d39fda662b96a2a)                                                                                   
    Downloading: 100%                                                                                                                                              
    Unpacking: 100%                                                                                                                                                
    Unpacked 2822 files and folders to /home/taylor/.vscode- 
    server/bin/3b889b090b5ad5793f524b5d1d39fda662b96a2a. 
    

Following this, everything was working for me again. Recap: Just disable and re-enable the Windows Subsystem for Linux feature.

Related