Home > Net >  WSL Not Starting in VS Code - tried updating it, wsl shutdown, and restarting computer
WSL Not Starting in VS Code - tried updating it, wsl shutdown, and restarting computer

Time:01-24

I'm getting this error regarding WSL2 not starting. I've tried doing wsl --shutdown wsl in PowerShell and restarting my computer but it's still not running. The state in PowerShell says it's running, though, I am still getting the error. If I open Ubuntu in Windows and run code . that doesn't work either. I've updated wsl to the latest version. Thanks for your help!

[2023-01-23 06:26:26.345] Starting VS Code Server inside WSL (wsl2)
[2023-01-23 06:26:26.345] Extension version: 0.72.0
[2023-01-23 06:26:26.345] Windows build: 19044. Multi distro support: available. WSL path support: enabled
[2023-01-23 06:26:26.346] No shell environment set or found for current distro.
[2023-01-23 06:26:26.507] WSL daemon log file: 
[2023-01-23 06:26:26.510] Probing if server is already installed: C:\WINDOWS\System32\wsl.exe -d Ubuntu -e sh -c "[ -d ~/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534 ] && printf found || ([ -f /etc/alpine-release ] && printf alpine-; uname -m)"
[2023-01-23 06:26:29.965] Probing result: found
[2023-01-23 06:26:29.966] Server install found in WSL
[2023-01-23 06:26:29.967] Launching C:\WINDOWS\System32\wsl.exe -d Ubuntu sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" 97dec172d3256f8ca4bfb2143f3f76b503ca0534 stable code-server .vscode-server --host=127.0.0.1 --port=0 --connection-token=1837640582-1523319798-660006518-1171681990 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2023-01-23 06:26:30.216] Setting up server environment: Looking for /home/samtimus/.vscode-server/server-env-setup. Not found.
[2023-01-23 06:26:30.216] WSL version: 5.15.79.1-microsoft-standard-WSL2 Ubuntu
[2023-01-23 06:26:30.216] WSL-shell-PID: 13
[2023-01-23 06:26:30.216] Node executable: /home/samtimus/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534/node
[2023-01-23 06:26:30.216] Starting server: /home/samtimus/.vscode-server/bin/97dec172d3256f8ca4bfb2143f3f76b503ca0534/bin/code-server --host=127.0.0.1 --port=0 --connection-token=1837640582-1523319798-660006518-1171681990 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all
[2023-01-23 06:26:30.217] VS Code Server for WSL closed unexpectedly.
[2023-01-23 06:26:30.217] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2023-01-23 06:26:30.222] C:\WINDOWS\System32\wsl.exe -d Ubuntu -e kill 13
[2023-01-23 06:26:30.546] WSL Daemon exited with code 0

PS C:\Users\User> wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Running         2

PS C:\Users\User> wsl --update
Checking for updates.
The most recent version of Windows Subsystem for Linux is already installed.

CodePudding user response:

When you installed your sub-system (UBUNTU) the system created a shortcut to having direct access to the shell.

If you don't, open your PowerShell and exec BASH. If still don't, open your VSCODE on windows.

Install the extension WSL EXTENSION.

Open a WSL terminal window (using the start menu item or by typing wsl from a command prompt / PowerShell.

Another way is. Open your VSCODE on windows, press F1 and select WSL: New WSL Window.

CodePudding user response:

I was able to figure it out with the following steps!

Within the WSL terminal, type rm -r ~/.vscode-server to delete the VS Code WSL server. Exit the terminal and from your PowerShell/Cmd, run wsl --shutdown . Then you can log in back to your WSL and run code . and it should work normally.

  • Related