cursor icon indicating copy to clipboard operation
cursor copied to clipboard

Cursor is not starting in WSL

Open ManciDRaffy opened this issue 1 year ago • 12 comments

  1. If you can, please include a screenshot of your problem image

  2. Please include the name of your operating system Windows 11

  3. If you can, steps to reproduce are super helpful For me its, install cursor and try to connect to WSL.

Tried reinstalling, deleting the .cursor-server folder and the "Fix Wsl inside Cursor".

This error happens since last update to 0.35.1.

Downgrading doesnt fix anything

Edit: Yes the shell is set to /bin/zsh and worked last week until Monday or Tuesday

ManciDRaffy avatar Jun 24 '24 13:06 ManciDRaffy

I was able to reproduce this issue in my setup and find the root cause.

VSCode forces to use latest extension version (0.88.2) for some reason, while Cursor sticks to the extension version 0.81.8. I forced Cursor to install the latest version by downloading it manually and then restart it and it got me to a next step where Cursor is trying to download a different commit ID for the WSL shell environment.

Basically, the current Cursor's build is pointing to the cursor's commit ID, instead of pointing to the VSCode one; in my case, it is looking for the commit id 9a6d781540ba2732cf26551c07629e68121c6580 instead of the id ea1445cc7016315d0f5728f8e8b12a45dc0a7286.

I'd say the issue is somewhat related with Cursor not allowing to download the latest VScode version for wsl extension and/or more deep down, Cursor sticking with the wrong commit ID even after clearing cache

image

ricaguzam avatar Jul 09 '24 03:07 ricaguzam

Any updates on this? It is garbage to have to use PowerShell.

ManciDRaffy avatar Jul 26 '24 13:07 ManciDRaffy

Hey, it's been two weeks again. Can I help? Do I need to provide more context? Or is this just a dead issue board :|

ManciDRaffy avatar Aug 08 '24 07:08 ManciDRaffy

I ended up just doing a full os wipe - fresh setup with latest versions of cursor etc. It had been a while anyway. Working now. Something in the update chain or cache is broken since fresh install of everytjing works.

RobertHH-IS avatar Aug 08 '24 12:08 RobertHH-IS

I'm unable to completely reinstall my operating system. I've removed everything related to the cursor, including registry entries and any leftover files. Unfortunately, I'm still getting a "no shell environment" error. Is there a way to enable logging or troubleshooting to help diagnose the issue? I haven't been able to find any relevant options through search or by visually inspecting the system.

ManciDRaffy avatar Aug 13 '24 07:08 ManciDRaffy

It is working on my side after I updated to Cursor version 0.39.0 and VSCode version 1.91.1

ricaguzam avatar Aug 13 '24 15:08 ricaguzam

Having the same issue. Any update? Cursor version 0.40.1 VSCode version 1.91.1

ShisunXia avatar Aug 28 '24 22:08 ShisunXia

Hello, I have similar issue on my side, after an update this morning:

[2024-08-29 11:22:04.939] Extension version: 0.88.2
[2024-08-29 11:22:04.939] L10N bundle: undefined
[2024-08-29 11:22:04.993] authorityHierarchy: wsl+ubuntu-22.04
[2024-08-29 11:22:04.993] WSL extension activating for a local WSL instance
[2024-08-29 11:22:05.026] Resolving wsl+ubuntu-22.04, resolveAttempt: 1
[2024-08-29 11:22:05.027] NodeExecServer run: C:\Windows\System32\wsl.exe --status
[2024-08-29 11:22:05.132] WSL feature installed: true (wsl --status)
[2024-08-29 11:22:05.132] NodeExecServer run: C:\Windows\System32\wsl.exe --list --verbose
[2024-08-29 11:22:05.265] 3 distros found
[2024-08-29 11:22:05.266] Starting VS Code Server inside WSL (wsl2)
[2024-08-29 11:22:05.266] Windows build: 22631. Multi distro support: available. WSL path support: enabled
[2024-08-29 11:22:05.266] Scriptless setup: false
[2024-08-29 11:22:05.267] No shell environment set or found for current distro.
[2024-08-29 11:22:05.482] WSL daemon log file: 
[2024-08-29 11:22:05.487] Probing if server is already installed: if [ -d ~/.cursor-server/bin/cda482b45f8d679344885ceb091f550a29fb00d0 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; if [ -s ~/.cursor-server/bin/compatibilty-check ]; then printf 'legacy-'; fi; uname -m;
[2024-08-29 11:22:05.488] NodeExecServer run: C:\Windows\System32\wsl.exe -d Ubuntu-22.04 -e sh -c if [ -d ~/.cursor-server/bin/cda482b45f8d679344885ceb091f550a29fb00d0 ]; then printf 'install-found '; fi; if [ -f /etc/alpine-release ]; then printf 'alpine-'; fi; if [ -s ~/.cursor-server/bin/compatibilty-check ]; then printf 'legacy-'; fi; uname -m;
[2024-08-29 11:22:05.727] Probing result: legacy-x86_64
[2024-08-29 11:22:05.728] No server install found in WSL, needs linux-legacy-x64
[2024-08-29 11:22:05.728] Getting server from client side
[2024-08-29 11:22:05.729] Downloading VS Code Server stable - cda482b45f8d679344885ceb091f550a29fb00d0 into C:\Users\ANTHON~1\AppData\Local\Temp\vscode-remote-wsl\stable\cda482b45f8d679344885ceb091f550a29fb00d0\vscode-server-stable-linux-legacy-x64.tar.gz.
[2024-08-29 11:22:06.861] Unable to download server on client side: Error: Request downloadRequest failed unexpectedly without providing any details.. Will try to download on WSL side.
[2024-08-29 11:22:06.862] NodeExecServer run: C:\Windows\System32\wsl.exe -d Ubuntu-22.04 sh -c '"$VSCODE_WSL_EXT_LOCATION/scripts/wslServer.sh" cda482b45f8d679344885ceb091f550a29fb00d0 stable cursor-server .cursor-server --host=127.0.0.1 --port=0 --connection-token=4100728933-346482070-3250075906-2914110915 --use-host-proxy --without-browser-env-var --disable-websocket-compression --accept-server-license-terms --telemetry-level=all'
[2024-08-29 11:22:07.178] Setting up server environment: Looking for /home/anthony/.cursor-server/server-env-setup. Not found.
[2024-08-29 11:22:07.178] WSL version: 5.15.153.1-microsoft-standard-WSL2 Ubuntu-22.04
[2024-08-29 11:22:07.178] Updating VS Code Server to version cda482b45f8d679344885ceb091f550a29fb00d0
[2024-08-29 11:22:07.178] Removing previous installation...
[2024-08-29 11:22:07.178] Installing VS Code Server for Linux legacy-x64 (cda482b45f8d679344885ceb091f550a29fb00d0)
[2024-08-29 11:22:07.178] Downloading:     
[2024-08-29 11:22:07.794] 100%
[2024-08-29 11:22:07.794] Failed
[2024-08-29 11:22:07.794] --2024-08-29 13:22:07--  https://update.code.visualstudio.com/commit:cda482b45f8d679344885ceb091f550a29fb00d0/server-linux-legacy-x64/stable
[2024-08-29 11:22:07.794] Resolving update.code.visualstudio.com (update.code.visualstudio.com)... 13.107.246.43, 2620:1ec:bdf::43
[2024-08-29 11:22:07.794] Connecting to update.code.visualstudio.com (update.code.visualstudio.com)|13.107.246.43|:443... connected.
[2024-08-29 11:22:07.963] HTTP request sent, awaiting response... 404 Not Found
[2024-08-29 11:22:07.963] 2024-08-29 13:22:07 ERROR 404: Not Found.
[2024-08-29 11:22:07.963] 
[2024-08-29 11:22:07.963] ERROR: Failed to download https://update.code.visualstudio.com/commit:cda482b45f8d679344885ceb091f550a29fb00d0/server-linux-legacy-x64/stable to /home/anthony/.cursor-server/bin/cda482b45f8d679344885ceb091f550a29fb00d0-1724930527.tar.gz
[2024-08-29 11:22:07.963] For help with startup problems, go to https://code.visualstudio.com/docs/remote/troubleshooting#_wsl-tips
[2024-08-29 11:22:10.692] Download in background is enabled

don4get avatar Aug 29 '24 11:08 don4get

I fixed the issue by following the instruction written in this comment

ShisunXia avatar Sep 04 '24 22:09 ShisunXia

Latest Windows Update just broke Cursor WSL connection... anyone else?

RobertHH-IS avatar Sep 11 '24 08:09 RobertHH-IS

Ditto for me. Cursor with WSL was working until I installed Windows update

2024-09 Cumulative Update Preview for Windows 11 Version 23H2 for x64-based Systems (KB5043145)

jontybrook avatar Oct 01 '24 12:10 jontybrook

Ditto for me. Cursor with WSL was working until I installed Windows update

I just checked and I haven't installed this update(KB5043145) on my system yet. The Cursor was working fine two days ago, but now I am unable to run it.

EDIT: I have installed the KB5043145 and the problem disappeared.

quantavi avatar Oct 02 '24 19:10 quantavi

Same here

mingi3314 avatar Oct 11 '24 01:10 mingi3314

I encountered the same issue when trying to connect to WSL. It said, "No shell environment set or found for the current distro." I attempted to fix it by running the "fixwslinstall" command through the Ctrl + P panel, but nothing showed up—not even error messages.

Next, I manually ran the fixwslinstall PowerShell script but encountered a privilege issue. Even when I tried running it as an administrator, it failed. After inspecting the PowerShell code, I found that the failure occurred when copying the server-env-setup file to the WSL machine. Although I eventually managed to copy this file and others using direct commands, I still encountered the same error as before.

I then reinstalled both the Cursor app and the WSL plugin, but the problem persisted. Finally, I deleted the .cursor folder from the Windows user profile, reinstalled Cursor—and that solved the issue.

I don't know if you are in the same situation as me, but I hope this helps.

iteng007 avatar Oct 24 '24 12:10 iteng007

I faced the same issue since the latest Windows 11 update. Uninstalling the WSL extension and restarting Cursor did the trick for me. Be sure to close the remote connection first (CTRL+SHIFT+P > "Remote: Close Remote Connection"). Then open any local file (so you have access to the extensions tab), go to the extensions tab in the left side bar, search for "wsl", right click and then "Uninstall". After restarting Cursor my problem was gone.

fredpe avatar Nov 14 '24 07:11 fredpe

I faced the same issue since the latest Windows 11 update. Uninstalling the WSL extension and restarting Cursor did the trick for me. Be sure to close the remote connection first (CTRL+SHIFT+P > "Remote: Close Remote Connection"). Then open any local file (so you have access to the extensions tab), go to the extensions tab in the left side bar, search for "wsl", right click and then "Uninstall". After restarting Cursor my problem was gone.

Same here. Opening a local project allowed me to uninstall the extension, and upon restarting cursor I was prompted to reinstall the extension. Reinstalled it and everything seems to be working as normal.

bacchist avatar Nov 14 '24 15:11 bacchist

Uninstalling the extension on a local project, re-opening a remote one, and clicking on Install extension and reload works for me every time, without having to close remote connection.

gabrii avatar Dec 12 '24 10:12 gabrii

Can confirm the following also for WSL2 Ubuntu. The issue seemed to trigger after I opened a Windows based node project. Uninstall and re-install didn't work.

Steps that worked for me:

  1. Open windows based project (Not connected to WSL2)
  2. Uninstall the WSL extension and re-load the project
  3. Open a WSL2 related project and be prompted to re-install - Which you do and working as normal

EDIT

  • When it wasn't working, doing a ls .cursor-server resulted in an empty folder within a normal wsl2 window. It seems it was cleared
  • After running the fix:
$ ls .cursor-server
bin  data  extensions

NaveenNeti avatar Dec 30 '24 04:12 NaveenNeti

I faced the same issue since the latest Windows 11 update. Uninstalling the WSL extension and restarting Cursor did the trick for me. Be sure to close the remote connection first (CTRL+SHIFT+P > "Remote: Close Remote Connection"). Then open any local file (so you have access to the extensions tab), go to the extensions tab in the left side bar, search for "wsl", right click and then "Uninstall". After restarting Cursor my problem was gone.

This worked For me

merouaneamqor avatar Jan 23 '25 13:01 merouaneamqor

I faced the same issue since the latest Windows 11 update. Uninstalling the WSL extension and restarting Cursor did the trick for me. Be sure to close the remote connection first (CTRL+SHIFT+P > "Remote: Close Remote Connection"). Then open any local file (so you have access to the extensions tab), go to the extensions tab in the left side bar, search for "wsl", right click and then "Uninstall". After restarting Cursor my problem was gone.我自从最新的 Windows 11 更新以来遇到了相同的问题。卸载 WSL 扩展并重新启动 Cursor 对我有效。请确保首先关闭远程连接(CTRL+SHIFT+P > "远程:关闭远程连接")。然后打开任何本地文件(这样你就有权限访问扩展选项卡),在左侧栏中转到扩展选项卡,搜索“wsl”,右键点击然后“卸载”。重启 Cursor 后我的问题就消失了。

it's work for me

x-rush avatar Feb 18 '25 08:02 x-rush

I faced the same issue since the latest Windows 11 update. Uninstalling the WSL extension and restarting Cursor did the trick for me. Be sure to close the remote connection first (CTRL+SHIFT+P > "Remote: Close Remote Connection"). Then open any local file (so you have access to the extensions tab), go to the extensions tab in the left side bar, search for "wsl", right click and then "Uninstall". After restarting Cursor my problem was gone.

Half year ago I liked this comment since it was the only one worked for me, half year later when I got the same problem - it still works!

Datswishty avatar Feb 24 '25 07:02 Datswishty

yea i had to manually remove ~\cursor\extensions\ms-vscode-remote.remote-wsl-* then reinstall this wsl extension

lee101 avatar Feb 26 '25 06:02 lee101

Just wanted to add something here in my case vs code was working fine but cursor not. When I ran: wsl -l -v

  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop         Running         2
  docker-desktop-data    Running         2

The default was not Ubuntu but docker, cursor seems to connect to the default wsl, so it tried to connect to docker. So running: wsl --setdefault Ubuntu fixed the issue. I think especially after updates it looses the right wsl env to connect to and just chooses the default.

MaximilianRadons avatar Mar 26 '25 12:03 MaximilianRadons

Recently started having this exact same issue.

yea i had to manually remove ~\cursor\extensions\ms-vscode-remote.remote-wsl-* then reinstall this wsl extension

Running the above in Powershell (".cursor" instead of "cursor") after completely closing Cursor fixed it. Then restart twice (it might prompt you to), install WSL extension normally and it should work.

Zeryther avatar Apr 14 '25 18:04 Zeryther

Not working for me with all the previous fix proposals. When WSL Extension gets reinstalled, i instantly get the error "The WSL extension closed unexpectedly." The ls command in the cursor-server directory has only bin inside

$ ls ~/.cursor-server/
bin

Also, the default WSL instance is "Ubuntu", and not "docker" as Maximilian pointed out before.

Latest VS Code is working fine on the same distro.

SunTrustDev avatar May 11 '25 13:05 SunTrustDev

What ended up working for me is to just restart wsl. Close cursor and run wsl --shutdown and then reopen wsl in cursor did the trick. Fyi, my default was already Ubuntu.

sophiabq06 avatar May 17 '25 18:05 sophiabq06

@sophiabq06 Your solution works. I couldnt get the IntelliSense work before and I tried the wsl shutdown and it is working now! Thanks.

zhangxingeng avatar May 31 '25 17:05 zhangxingeng

rm -rf ~/.cursor*

eatcosmos avatar Jun 25 '25 09:06 eatcosmos

I experienced this issue anytime there was an update for the cursor. After updating cursor, it couldn't open folders in WSL anymore, and it could take a few days to fix automatically.

I don't know what the issue but I figured out that when there is an update, run code . in the folder you want to open in WSL and let it download the new version. While it's downloading the update, open a local folder in cursor and keep it open, then when the download is finished, the cursor will open in WSL as normal.

TrustWarden avatar Jul 02 '25 18:07 TrustWarden