Unable to run WSL2 from cursor

When I try to connect to the WSL2 visual code server for the first time I get the error that I am unable to download the server. Full logs are here. Please help. I can’t add the logs because it says “New users can only have two links” and even though I thought I removed all the links from the logs it still was giving me the error. However, the logs say it can’t find the server commit 1a7903c409e3e915db28f4c124497660066e85a0. Which when I click the link can confirm that commit does not exist. https://update.code.visualstudio.com/commit:1a7903c409e3e915db28f4c124497660066e85a0/server-linux-x64/stable

Does it work if you run the “Fix WSL” command from the Command Palette (Ctrl + Shift + P) before connecting? This command rewrites the server-env-setup file in the WSL file system.

It will auto-run for many users, but there are a couple of known ways that you can connect to WSL without the fix being applied.

If that doesn’t work for you, seeing your full logs would be very helpful. Perhaps a screenshot would work?

Thanks… I tried Fix WSL and it still didn’t work. See image for full log. Edit: also note that I can run WSL from VS Studio Code

Could you report the output of the following command in Powershell (after replacing YOUR_WINDOWS_USERNAME):

powershell.exe -ExecutionPolicy Bypass -File "C:\Users\YOUR_WINDOWS_USERNAME\AppData\Local\Programs\cursor\resources\app\bin\fixWSLNew.ps1" -pathToAdd "C:\Users\YOUR_WINDOWS_USERNAME\AppData\Local\Programs\cursor\resources\app" -scriptPath "C:\Users\YOUR_WINDOWS_USERNAME\AppData\Local\Programs\cursor\resources\app\bin\server-env-setup"

It seems your server-env-setup file isn’t being created by the Fix WSL command and want to dig into why.

1 Like

I tried the powershell command but got an error… In debugging that error it seems there was a problem with my path environmental variable. I fixed that variable and then reran the script and now wsl environment is working. Thanks!

1 Like

Amazing. Could you share what the error was? Might help us make a systematic fix for other users.

It said something like “cannot find powershell.exe” That’s what led me to believe that I had an issue with my PATH environment.