-
Notifications
You must be signed in to change notification settings - Fork 1.9k
WSL:Connect to WSL
fails (can not download)
#660
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
EDIT: To fix this, do the following:
Now, if you install the WSL extension and run Ctrl + Shift + P then the "Connect to WSL" command, you should be able to open a WSL folder in Cursor. |
same problem but, then try |
I use ubuntu, so should I use VSCodium-linux-x64-1.79.2.23166.tar.gz ? what is |
e3abfc3de36742f113a8f1f4648d8c7044ec2f31 is the commit that your install is searching. (look you log) in your release VSCodium-linux-x64-1.79.2.23166.tar.gz. |
the problem is that with every cursor update it tries to download a new version of vscodium based on the cursor commit. |
Is there any script to make this easier? |
It’s already easy manually. |
VSCodium/vscodium#1265 (comment) # uncomment the following line to enable debugging
#export VSCODE_WSL_DEBUG_INFO=true
fix_download() {
case "$QUALITY" in
stable)
local repo_name='vscodium'
local app_name='codium';;
insider)
local repo_name='vscodium-insiders'
local app_name='codium-insiders';;
*)
echo "unknown quality: $QUALITY" 1>&2
return 1;;
esac
local ps='/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
local cmd="(Get-Command $app_name).Path | Split-Path | Split-Path"
local install_dir=$(wslpath -u "$($ps -nop -c "$cmd | Write-Host -NoNewLine")")
local product_json="$install_dir/resources/app/product.json"
local release=$(jq -r .release "$product_json")
local version=$(jq -r .vscodeVersion "$product_json" | sed "s#\(-$QUALITY\)\?\$#.$release&#")
case $version in null.*)
version=$(jq -r .version "$product_json" | sed "s#\(-$QUALITY\)\?\$#.$release&#");;
esac
local arch=$(uname -m)
case $arch in
x86_64)
local platform='x64';;
armv7l | armv8l)
local platform='armhf';;
arm64 | aarch64)
local platform='arm64';;
*)
echo "unknown machine: $arch" 1>&2
return 1;;
esac
local url="https://github.com/VSCodium/$repo_name/releases/download/$version/vscodium-reh-linux-$platform-$version.tar.gz"
export VSCODE_SERVER_TAR=$(curl -fLOJ "$url" --output-dir /tmp -w '/tmp/%{filename_effective}')
export REMOVE_SERVER_TAR_FILE=true
}
[ "$VSCODE_WSL_DEBUG_INFO" = true ] && set -x
if [ ! -d "$HOME/$DATAFOLDER/bin/$COMMIT" ]; then
if [ ! -d "$HOME/$DATAFOLDER/bin_commit" ]; then
set -e
fix_download
set +e
fi
fi
unset fix_download |
if we don't have this file, we can create it and only past your code ? or we need the default file before? (and where to get it?) Edit: try with only your code, seems good, thx man |
Thx! The diff is : |
@sisrfeng do you have a fix_download script update ? WSL don't work with new version of cursor: [2023-07-19 12:36:35.692] Setting up server environment: Looking for /home/ben/.vscodium-server/server-env-setup. Found, executing... [2023-07-19 12:36:42.481] --2023-07-19 14:36:42-- https://update.code.visualstudio.com/commit:2d7a33f66a5157c6378a1621ddb89d4130ab3659/server-linux-x64/stable Version: 0.2.49 |
@truell20, any updates on this? Planning on trialling this IDE for my team. But we use WSL2 for our work, and it's not currently working. Even with these workarounds, any ETA? |
Sorry, no. I used |
Okay, so I took the script above that someone wrote in the VSCodium issues and then tweaked it further. Ensure you are updated to the latest version of Cursor (at the time it's 0.3.1). Create a folder in your home directory. If this folder exists, make sure to delete everything in it. It will make your WSL extensions need to be reinstalled but that is no issue to do them cause they are stored on the Windows side. mkdir $HOME/.vscodium-server
cd $HOME/.vscodium-server then nano server-env-setup and then paste this code into there and save the file. NOTE: If you don't have the cursor command installed for CLI use (Way easier if do install it with export VSCODE_WSL_DEBUG_INFO=true
fix_download() {
case "$QUALITY" in
stable)
local repo_name='vscodium'
local app_name='cursor';;
insider)
local repo_name='vscodium-insiders'
local app_name='codium-insiders';;
*)
echo "unknown quality: $QUALITY" 1>&2
return 1;;
esac
local ps='/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
local cmd="(Get-Command $app_name).Path | Split-Path | Split-Path"
local install_dir=$(wslpath -u "$($ps -nop -c "$cmd | Write-Host -NoNewLine")")
local product_json="$install_dir/product.json"
local release=$(jq -r .release "$product_json")
local version=$(jq -r .vscodeVersion "$product_json" | sed "s#\(-$QUALITY\)\?\$#.$release&#")
case $version in null.*)
version=$(jq -r .version "$product_json" | sed "s#\(-$QUALITY\)\?\$#.$release&#");;
esac
local arch=$(uname -m)
case $arch in
x86_64)
local platform='x64';;
armv7l | armv8l)
local platform='armhf';;
arm64 | aarch64)
local platform='arm64';;
*)
echo "unknown machine: $arch" 1>&2
return 1;;
esac
local url="https://github.com/VSCodium/$repo_name/releases/download/$version/vscodium-reh-linux-$platform-$version.tar.gz"
export VSCODE_SERVER_TAR=$(curl -fLOJ "$url" --output-dir /tmp -w '/tmp/%{filename_effective}')
export REMOVE_SERVER_TAR_FILE=true
}
[ "$VSCODE_WSL_DEBUG_INFO" = true ] && set -x
if [ ! -d "$HOME/$DATAFOLDER/bin/$COMMIT" ]; then
if [ ! -d "$HOME/$DATAFOLDER/bin_commit" ]; then
set -e
fix_download
set +e
fi
fi
unset fix_download Then open Cursor in Windows, and install the extensions This will open a new Cursor window with it initializing the WSL connection. It will then set up the vscodium-server using the script we pasted. And Tada should have WSL working. This is a hacky workaround and might have some hiccups. |
^ confirmed by the devs that this should work. Make sure to double check that |
LATEST FIX as of July 31, 2023 We are now hosting our own Cursor servers so you can use AI tools inside of WSL! MAKE SURE:
Inside of export VSCODE_WSL_DEBUG_INFO=true
fix_download() {
case "$QUALITY" in
stable)
local app_name='cursor';;
*)
echo "unknown quality: $QUALITY" 1>&2
return 1;;
esac
local ps='/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe'
local cmd="(Get-Command $app_name).Path | Split-Path | Split-Path"
local install_dir=$(wslpath -u "$($ps -nop -c "$cmd | Write-Host -NoNewLine")")
local product_json="$install_dir/product.json"
local release=$(jq -r .cursorServerRelease "$product_json")
local vscodium_release=$(jq -r .release "$product_json")
local version=$(jq -r .version "$product_json")
local vscodium_version=$(jq -r .vscodeVersion "$product_json")
case $version in null.*)
version=$(jq -r .version "$product_json");;
esac
case $vscodium_version in null.*)
vscodium_version=$(jq -r .version "$product_json");;
esac
local arch=$(uname -m)
case $arch in
x86_64)
local platform='x64';;
armv7l | armv8l)
local platform='armhf';;
arm64 | aarch64)
local platform='arm64';;
*)
echo "unknown machine: $arch" 1>&2
return 1;;
esac
local url="https://cursor.blob.core.windows.net/remote-releases/${version}-${release}/vscode-reh-linux-${platform}.tar.gz"
local fallback_url="https://github.com/VSCodium/vscodium/releases/download/${vscodium_version}.${vscodium_release}/vscodium-reh-linux-${platform}-${vscodium_version}.${vscodium_release}.tar.gz"
# Attempt to download from the initial URL
export VSCODE_SERVER_TAR=$(curl -fLOJ "$url" --output-dir /tmp -w '%{filename_effective}')
if [ $? -ne 0 ]; then
# If the download fails, attempt to download from the fallback URL
export VSCODE_SERVER_TAR=$(curl -fLOJ "$fallback_url" --output-dir /tmp -w '/tmp/%{filename_effective}')
fi
export REMOVE_SERVER_TAR_FILE=true
}
[ "$VSCODE_WSL_DEBUG_INFO" = true ] && set -x
if [ ! -d "$HOME/$DATAFOLDER/bin/$COMMIT" ]; then
if [ ! -d "$HOME/$DATAFOLDER/bin_commit" ]; then
set -e
fix_download
set +e
fi
fi
unset fix_download |
DO NOT WORK WITH LATEST 0.6 VERSION. Had to go back to 0.5.1 Edit: It automatically updated back to 0.6.0. SO IT IS NOT WORKING |
@Cafezinho are you using the newest script I just posted above? What error do you get? |
@walnutwaldo When I install 0.6.0, when I put the script in the new folder it gives me: ".cursor-server/bin/74f6148eb9ea00507ec113ec51c489d6ffb4b771/bin/codium-server: not found" When I rename code-server to codium-server it gives me type mismatch Thanks for the help |
@Cafezinho I think I understand your issue now; I've encountered it before as well. This happens because before you created the script, the WSL extension downloaded an incompatible version on its own. After creating the script, it didn't update it due to the existence of the server component. The solution is to delete everything in the ~/.cursor-server directory except for server-env-setup. Then, reopen Cursor, and the script will take effect and download the correct components. |
@Cafezinho Can you show me the complete terminal output? It seems like the script did not work in your environment. |
@Cafezinho In your WSL environment, is there codium-server or code-server in the directory ~/.cursor-server/bin/74f6148eb9ea00507ec113ec51c489d6ffb4b771/bin? |
code-server |
@Cafezinho usually you need to clear out your entire ~/.cursor-server folder except for the server-env-setup file and then retry. |
Have seen this work if you close of the window and try again? @Tusen183 Is it persistent? |
@lacion Did you run "Fix WSL" first? If yes, then can you send the output of these two commands:
|
@truell20 I Tried it. There wasn't any output, so I don't know if it executed it. This issue only happens with Centos 7, I have no problem with Ubuntun 20.04. I guess it's not Cursor's problem. |
Still does not work for me too |
@truell20 It can work now.But I don't know which step make it work. I removed all the servers related to cursor and vscode, did what @danielvds01x mentioned, and opened tcpforward in the ssh config. |
I get this error inside WSL, even after running the "fix WSL" script:
|
Ah, right now we only support opening WSL from Cursor itself, instead of from the command line. You need to run Ctrl+Shift+P, "Connect to WSL." |
Error:There was a problem connecting to WSL after the updated version, the link is invalid. Can I roll back the version, and it will work normally after manually installing the server in the previous version. Os:wsl ubuntu20.04 LTS Version: 0.9.1 Error[2023-08-31 01:35:58.833] --2023-08-31 09:35:58-- https://update.code.visualstudio.com/commit:30d21e59529ff0a52d8a847c419e668f2fd2d620/server-linux-x64/stable |
Error in version 0.9.1. Keeps happening every 3 updates. Needs fix ASAP |
HELPPPPPPPPPPPPPPPPPPPP |
@Cafezinho I use 0.8, can work. |
How can I download 0.8 now? |
Worked on 0.9.1 if you apply fix inside cursor using Ctrl P + Fix WSL and after restart your computer. |
whoaa, I just tried it and it works |
still no luck on my end |
I dont even find such a command in my command palette |
You need to install the WSL extension @Kardev07 |
Also want to know this! Previous versions were working for me but now everything is broken :( |
@vmasrani What problem are you encountering? Could you provide a screenshot? |
Latest update has broken my WSL. Having the same issue as discussed here, even after running Fix WSL and restarting. Version: 0.10.4 |
Rolling back worked for me. See: https://forum.cursor.sh/t/cant-connect-to-remote-ssh-server-after-recent-update/632/5 |
After running the Fix WSL I had to convert the server-env-setup file from ANSI to UTF-8, since my user name contains german special characters. |
This helped me with finish version of machine... fix it to utf-8 automatically |
Any latest official solution for connecting to wsl ? Since the time I commented (#660 (comment)), I can connect to wsl. But recently it fails again. |
Same issue. Hope if will be fixed ASAP as it is a critical bug in my opinion. |
This solved it for me as well, thanks 👍 |
Fixed for me by opening settings UI and changing "Remote.SSH.Local Server Download" from "auto" to "always". |
If Docker is installed, Connect to WSL may default to Docker's WSL instance. This could cause errors, like download failures or other environment issues. Use |
command
error
In wsl, this command fails:
wget 'https://update.code.visualstudio.com/commit:e3abfc3de36742f113a8f1f4648d8c7044ec2f31/server-linux-x64/stable'
OS
win11, wsl

cat /etc/issue :
Ubuntu 22.04.2 LTS \n \l
The text was updated successfully, but these errors were encountered: