Skip to content
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

Make the WSL remote extension work in VS Codium #1265

Open
wolfygit opened this issue Sep 20, 2022 · 38 comments
Open

Make the WSL remote extension work in VS Codium #1265

wolfygit opened this issue Sep 20, 2022 · 38 comments
Labels
bug Something isn't working

Comments

@wolfygit
Copy link

wolfygit commented Sep 20, 2022

After a while I managed to make the extension work with these changes:

1.Download the .vsix from https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl and install manually from the extensions section

2.In the file: C:\Users\%USERNAME%\.vscode-oss\extensions\ms-vscode-remote.remote-wsl-0.66.3\scripts\wslDownload.sh replace all "commit:$COMMIT" with "latest"

3.Open the extension And wait the download of the .vscodium-server within WSL user profile

4.In the file C:\Users\%USERNAME%\.vscode-oss\extensions\ms-vscode-remote.remote-wsl-0.66.3\scripts\wslServer.sh replace 'SERVER_APPNAME=$3' with 'SERVER_APPNAME="code-server"'

5.In the file \\wsl$\Ubuntu\%USERNAME%\.vscodium-server\bin\%COMIT_ID%\product.json replace the value of the "commit": with the same value of "commit": found in your %VSCODIUM_INSTALLATION_DIRECTORY%\VSCodium\resources\app\product.json

6.In the file \\wsl$\Ubuntu\%USERNAME%\.vscodium-server\bin\%COMIT_ID%\out\vs\server\node\server.main.js search "if(!ye){if(this._environmentService.isBuilt)return ie("Unauthorized client refused")" and change the first if condition from '!ye' to 'false'

@wolfygit wolfygit added the bug Something isn't working label Sep 20, 2022
@0reo
Copy link

0reo commented Sep 20, 2022

this works. i also need to make a couple of links but that could be just my config using WSL. replace COMMIT_HASH with whatever you have locally after step 3

ln -s ~/.vscodium-server/bin/COMMIT_HASH/bin/code-server ~/.vscodium-server/bin/COMMIT_HASH/bin/codium-server
ln -s ~/.vscodium-server/bin/COMMIT_HASH/bin/remote-cli/code ~/.vscodium-server/bin/COMMIT_HASH/bin/remote-cli/codium

@dbarrerap
Copy link

Just as an update, on step 6, search for "Unauthorized client refused". There should be 2 instances, apply the fix to the second search result. The variable name changes in different versions, apparently (for me it was ve).

@mikefarmer01
Copy link

Thank you, great work.

I however perceive two flaws with the hack:
Firstly, step 6 basically allows unauthorized clients to connect.
Secondly, as soon as you launch Codium in a WSL folder, a folder ~/.vscode-server gets created&populated in the WSL.

Also, instead of changing the condition to false in step 6, you can just remove the exclamation mark.

@mpql
Copy link

mpql commented Dec 29, 2022

Here's kind of a roll-up of everything above, along with a few extra additions for issues I ran into. Also, addressing mikefarmer01's comment above, we create a symlink for .vscode-server. If I'm reading it right, I don't think the authorization is an issue, because there are other instances to check for auth mismatch and protocol, whereas the one we're changing just seems like it's designed to break things like Codium.

  1. Update Codium to latest from VSCodium/vscodium/releases you will likely have to expand the download list, as there's a lot of them. I personally like using the zip, as the latest installer as of this writing gave me a partial upgrade.
  2. Run Codium, and uninstall the "WSL" Remote extension.
  3. Download .vsix, in this case ms-vscode-remote.remote-wsl-0.72.0.vsix from VS Marketplace using the below javascriptlet.
  4. Open Codium and install the downloaded .vsix; dragging it into the extensions pane worked for me.
  5. In the file: %USERPROFILE%\.vscode-oss\extensions\ms-vscode-remote.remote-wsl-0.72.0\scripts\wslDownload.sh (changing as necessary for your installed version), replace all instances of commit:$COMMIT with latest.
  6. Open a WSL folder / window in Codium; it will try to start a download. Some people say it succeeds here -- so if it works for you, great, move on to step 9 -- but this part fails for me.
  7. Here, I use fiddler's AutoResponder to return the correct file, with the identifier in the first URL being the latest Codium release's commit hash, and the latter URL's being the corresponding version's commit hash from the vscode repository; i.e. if you installed Codium 1.74.2, get the commit hash for the release of VSCode 1.74.2 from VSCode's repo. For me, this looked like:
  8. Relaunch Codium, the download should succeed this time.
  9. Close Codium.
  10. In the file: %USERPROFILE%\.vscode-oss\extensions\ms-vscode-remote.remote-wsl-0.72.0\scripts\wslServer.sh, replace SERVER_APPNAME=$3 with SERVER_APPNAME="code-server".
  11. In WSL, in the file: ${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/product.json , replace the commit value with the VS Codium commit hash from earlier, in this case: d2c422ca15f1fbc976eed3e02e3392bbb39c5824. You can also get this from the value of commit in VSCodium\resources\app\product.json, from Codium's install directory, which is what clued me in to my having a partial upgrade earlier, as my version value was outdated.
  12. In WSL, in the file ${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/out/vs/server/node/server.main.js, where d2c422ca15f1fbc976eed3e02e3392bbb39c5824 is the latest Codium releases's commit hash, replace return fe("Unauthorized client refused); with console.warn("Ignoring: Unauthorized client refused");, where fe might be a different obfuscation.
  13. In a WSL prompt, create the following symlinks (I like relative links, but change to -s if you don't):
    ln -rs "${HOME}/.vscodium-server" "${HOME}/.vscode-server"
    	ln -rs "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/code-server" "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/codium-server"
    	ln -rs "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/remote-cli/code" "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/remote-cli/codium"
    Note that you can use -frs here to force link creation if you've already made links earlier and want to replace them.
  14. Launch Codium, and you should be all set!

Java Scriptlet to Download .vsix from VS Marketplace

javascript:(function() {const URL_VSIX_PATTERN = 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${publisher}/vsextensions/${extension}/${version}/vspackage';let itemName = new URL(window.location.href).searchParams.get('itemName');let[publisher,extension] = itemName.split('.');let version = document.querySelector('#versionHistoryTab tbody tr .version-history-container-column').textContent;let url = URL_VSIX_PATTERN.replace('${publisher}', publisher).replace('${extension}', extension).replace('${version}', version);window.open(url, '_blank');})();

Regarding the issue itself, I feel like it would be trivial to automate these changes and fix the download (assuming it's not something on my end). I'd be happy to submit a PR to this end if someone can direct me to where the logic for creating the vscodium.now.sh downloads is.

@daiyam
Copy link
Member

daiyam commented Dec 30, 2022

@mpql This is a license issue. Most Microsoft extensions became closed-source and have a license limiting them to be used only with Microsoft products.

If you want, you can use the extension VSIX Manager to automate the install of extensions from different marketplaces.

The best would be to have an open-source equivalent of that extension.

@mpql
Copy link

mpql commented Dec 30, 2022

@daiyam The most recent licensing terms in Microsoft/vscode-remote-release mention in the commit that they are trying to "clarify" that the license is only for the repo, but a) if you compile something from that code you can then use it however you like under that repo's terms (their compilation is, of course, the more restrictive terms), and b) as I understand it, even as the author, they cannot re-license it under more restrictive terms, they'd need to start a new repo and new codebase.

In addition to that, changing targets isn't reverse engineering, as JavaScript isn't compiled in the first place. Either a) Codium is not a Microsoft product, and thus running your own extension isn't either, or b) they both are and it falls under the license's use terms.

These are just my personal takes, and I realize y'all are likely CYA.

Thanks for the recommendation for VSIX Manager, I hadn't heard of that. That wouldn't do anything to extend licenses, but do you have any marketplace recommendations for working remote extensions?

The best would be to have an open-source equivalent of that extension.

Agreed. I wish they would, but I'm pretty sure Microsoft is too busy huffing their open core nonsense. They get to steal your data, or they try to stop you from using it with your OS lol.

@jacksongoode
Copy link

Here's kind of a roll-up of everything above, along with a few extra additions for issues I ran into. Also, addressing mikefarmer01's comment above, we create a symlink for .vscode-server. If I'm reading it right, I don't think the authorization is an issue, because there are other instances to check for auth mismatch and protocol, whereas the one we're changing just seems like it's designed to break things like Codium.

1. Update Codium to latest from [VSCodium/vscodium/releases](https://github.com/VSCodium/vscodium/releases) you will likely have to expand the download list, as there's a lot of them. I personally like using the zip, as the latest installer as of this writing gave me a partial upgrade.

2. Run Codium, and uninstall the "WSL" Remote extension.

3. Download `.vsix`, in this case `ms-vscode-remote.remote-wsl-0.72.0.vsix` from [VS Marketplace](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl) using the below javascriptlet.

4. Open Codium and install the downloaded `.vsix`; dragging it into the extensions pane worked for me.

5. In the file: `%USERPROFILE%\.vscode-oss\extensions\ms-vscode-remote.remote-wsl-0.72.0\scripts\wslDownload.sh` (changing as necessary for your installed version), replace all instances of `commit:$COMMIT` with `latest`.

6. Open a WSL folder / window in Codium; it will try to start a download. Some people say it succeeds here -- so if it works for you, great, move on to step 9 -- but this part fails for me.

7. Here, I use fiddler's AutoResponder to return the correct file, with the identifier in the first URL being the latest Codium release's commit hash, and the latter URL's being the corresponding version's commit hash from the [vscode repository](https://github.com/microsoft/vscode/releases); i.e. if you installed Codium `1.74.2`, get the commit hash for the release of VSCode `1.74.2` from [VSCode's repo](https://github.com/microsoft/vscode/releases). For me, this looked like:
   
   * https://vscodium.now.sh/commit:d2c422ca15f1fbc976eed3e02e3392bbb39c5824/server-linux-x64/stable
   * https://az764295.vo.msecnd.net/stable/e8a3071ea4344d9d48ef8a4df2c097372b0c5161/vscode-server-linux-x64.tar.gz
     Save these commit hashes for later, as you'll need them.

8. Relaunch Codium, the download should succeed this time.

9. Close Codium.

10. In the file: `%USERPROFILE%\.vscode-oss\extensions\ms-vscode-remote.remote-wsl-0.72.0\scripts\wslServer.sh`, replace `SERVER_APPNAME=$3` with `SERVER_APPNAME="code-server"`.

11. **In WSL**, in the file: `${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/product.json` , replace the `commit` value with the VS Codium commit hash from earlier, in this case: `d2c422ca15f1fbc976eed3e02e3392bbb39c5824`.  You can also get this from the value of `commit` in `VSCodium\resources\app\product.json`, from Codium's install directory, which is what clued me in to my having a partial upgrade earlier, as my `version` value was outdated.

12. **In WSL**, in the file `${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/out/vs/server/node/server.main.js`, where `d2c422ca15f1fbc976eed3e02e3392bbb39c5824` is the latest Codium releases's commit hash, replace `return fe("Unauthorized client refused);` with `console.warn("Ignoring: Unauthorized client refused");`, where `fe` might be a different obfuscation.

13. In a WSL prompt, create the following symlinks (I like relative links, but change to `-s` if you don't):
    ```shell
    ln -rs "${HOME}/.vscodium-server" "${HOME}/.vscode-server"
    	ln -rs "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/code-server" "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/codium-server"
    	ln -rs "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/remote-cli/code" "${HOME}/.vscodium-server/bin/d2c422ca15f1fbc976eed3e02e3392bbb39c5824/bin/remote-cli/codium"
    ```
    
    
        
          
        
    
          
        
    
        
      
    Note that you can use `-frs` here to force link creation if you've already made links earlier and want to replace them.

14. Launch Codium, and you should be all set!

Java Scriptlet to Download .vsix from VS Marketplace

javascript:(function() {const URL_VSIX_PATTERN = 'https://marketplace.visualstudio.com/_apis/public/gallery/publishers/${publisher}/vsextensions/${extension}/${version}/vspackage';let itemName = new URL(window.location.href).searchParams.get('itemName');let[publisher,extension] = itemName.split('.');let version = document.querySelector('#versionHistoryTab tbody tr .version-history-container-column').textContent;let url = URL_VSIX_PATTERN.replace('${publisher}', publisher).replace('${extension}', extension).replace('${version}', version);window.open(url, '_blank');})();

Regarding the issue itself, I feel like it would be trivial to automate these changes and fix the download (assuming it's not something on my end). I'd be happy to submit a PR to this end if someone can direct me to where the logic for creating the vscodium.now.sh downloads is.

Wow this is a hassle - especially as it updates for later version! A script for this would be so great :)

@eternalphane
Copy link

eternalphane commented Feb 4, 2023

Ultimate solution to make WSL extension work, no need to modify any vendor files

Add the following lines to ~/.vscodium-server(-insiders)/server-env-setup:

# 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 .version "$product_json" | sed "s#\(-$QUALITY\)\?\$#.$release&#")
    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
    set -e
    fix_download
    set +e
fi
unset fix_download

Note requires jq to be installed

@mpql
Copy link

mpql commented Feb 6, 2023

Thanks for sharing, @eternalphane! I will try this out on my next Windows Codium install and report back. 😄

@awebeer256
Copy link

I used @mpql's solution, and then installed an update to codium, which broke it. Instead of redoing it to make it work again, I used @eternalphane's solution, but then I still had to create a symlink in WSL: code-server -> codium-server in ~/.vscodium-server/bin/<hash>/bin, before it would work.

@mpql
Copy link

mpql commented Feb 9, 2023

Thanks for letting us know! Yeah, it breaks on updates. I'll have to switch methods next update. Cheers! 🍻

@awebeer256
Copy link

awebeer256 commented Feb 14, 2023

New development: what I describe above still breaks on updates to Codium, but I believe the following will instead break on updates to the WSL remote extension, which I believe are much less frequent.

Instead of creating the symlink like I describe above, edit the (Windows) file %userprofile%\.vscode-oss\extensions\ms-vscode-remote.remote-wsl-0.72.0\scripts\wslServer.sh. On line 6, we have SERVER_APPNAME="code-server". Change code-server to codium-server.

Edit for posterity: 0.72.0 is the extension's version number, so the exact path will change in the future to reflect that.

@jacksongoode
Copy link

@awebeer256 is there a similar script for Mac/Linux?

@awebeer256
Copy link

@jacksongoode Assuming the WSL extension works on those platforms, the procedure should work just as well. The only complication would be finding the .vscode-oss folder.

On Linux, I'd recommend looking in:

  • your home folder
  • ~/.config
  • $XDG_CONFIG_HOME (if it exists and is different than ~/.config)
  • ~/.config/VSCodium (recursive)
  • ~/.var/app/com.vscodium.codium (recursive) (Flatpak only)

For Mac, I dunno. You could open up a terminal and search in the same places as in Linux.

@FMGordillo
Copy link

FMGordillo commented Mar 14, 2023

Just doing the first two comments was running smooth for me!
I'm assuming that we will miss out extension updates for this, right?

Another question, how was your experience working with Extensions?
image

@TiLopes
Copy link

TiLopes commented May 22, 2023

I have been trying to make WSL work with VSCodium but I can't get it to work. I have tried using @eternalphane script and make @awebeer256 change to wslServer.sh but it seems they have removed the SERVER_APPNAME line.

WSL extension version: 0.78.7

Any input is appreciated.

@SuhasHebbar
Copy link

Workaround for folks who don't know about it.
If you don't want to break Microsoft's T&C on their proprietary extensions, you can use https://github.com/jeanp413/open-remote-ssh.

It functions similarly to the remote ssh extension by Microsoft. You'll just need to have an ssh server running in WSL either via systemd or manually call sudo /path/to/sshd -D

@TiLopes
Copy link

TiLopes commented May 23, 2023

@SuhasHebbar what is the performance like? Can I just edit files from WSL just fine? How would I setup the ssh connection?

@SuhasHebbar
Copy link

@SuhasHebbar what is the performance like? Can I just edit files from WSL just fine? How would I setup the ssh connection?

I just recently nuked my Windows installation and replaced it with archlinux, so I am mostly listing out things from memory.

I did not face any issues with performance over regular VSCode since there is no network lag in connecting to WSL. In fact, the experience isn't really different from Microsoft's remote ssh extension for the most part.

Setup (The extension README explains things pretty clearly)

  • Start sshd on your remote host. For WSL the easiest way to get going will be to run sudo /path/to/sshd -D. -D runs sshd in the foreground, but you can skip it if you want I guess. In case you face issues there are plenty of online resources on how to run an ssh server.
  • If you want to avoid this manual step you can enable systemd on WSL and run it through that.
  • You will have to install the open-remote-ssh from its vsix file.
  • Add you ssh server to your ssh config on windows. It will look something like
    Host my_wsl
    Hostname 127.0.0.1
    User
    Port 22 # Or something else if you modified the default sshd config.
  • You can setup identity key based authentication if you don't want to enter your password all the time.
  • And now you can connect to your WSL VM via the remote explorer section on the left bar.

open-remote-ssh will download the matching VSCodium remote extension host release from github releases and set it up on the remote host.

@timzuiddam
Copy link

timzuiddam commented Jun 27, 2023

With WSL, every extension I try to install results in:
[error] CorruptZip: end of central directory record signature not found

Someone already tackled this problem?

Context:

Release: 23166
Commit: 19c0f5cefaeb2637b45a9c7a356151fcfdcda1e9
Date: 2023-06-15T18:34:39.248Z
Electron: 22.3.10
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Windows_NT x64 10.0.19045

ms-vscode-remote version: v0.79.5

@Stivux
Copy link

Stivux commented Aug 16, 2023

I have WSL in Codium running with vscodium-reh-linux. It works without changing any files!
I also wrote this script to install/update vscodium-server (wget must be installed in your WSL-distro)
Save it as a .cmd file and run it from cmd

@echo off

setlocal
set /p WslName="Enter distro name: "
set /p CodiumPath="Enter Codium Path: "

for /f "tokens=2" %%i in ('findstr /c:"\"release\"" %CodiumPath%\resources\app\product.json') do set CodiumRelease=%%i
for /f "tokens=2" %%i in ('findstr /c:"quality" %CodiumPath%\resources\app\product.json') do set CodiumQuality=%%i
for /f "tokens=2" %%i in ('findstr /c:"commit" %CodiumPath%\resources\app\product.json') do set CodiumCommit=%%i
for /f %%i in ('wsl -d %WslName% whoami') do set WslUser=%%i

set CodiumRelease=%CodiumRelease:~1,-2%
set CodiumQuality=%CodiumQuality:~1,-2%
set CodiumCommit=%CodiumCommit:~1,-2%

if %CodiumQuality%==stable (
    set RepoName=vscodium
    set AppName=codium
) else if %CodiumQuality%==insider (
    set RepoName=vscodium-insiders
    set AppName=codium-insiders
) else (
    echo Unknowm quality: %CodiumQuality%
    exit /b
)

for /f "tokens=*" %%i in ('%CodiumPath%\bin\%AppName% -v') do (
    set CodiumVersion=%%i.%CodiumRelease%
    goto :VersionDone
)
:VersionDone

for /f %%i in ('wsl -d %WslName% uname -m') do (
    if %%i==x86_64 (
        set CodiumPlatform=x64
    ) else if %%i==armv7l (
        set CodiumPlatform=armhf
    ) else if %%i==armv8l (
        set CodiumPlatform=armhf
    ) else if %%i==arm64 (
        set CodiumPlatform=arm64
    ) else if %%i==aarch64 (
        set CodiumPlatform=arm64
    ) else (
        echo Unknowm machine: %%i
        exit /b
    )
)

set DownloadUrl=https://github.com/VSCodium/%RepoName%/releases/download/%CodiumVersion%/vscodium-reh-linux-%CodiumPlatform%-%CodiumVersion%.tar.gz

if exist \\wsl$\%WslName%\home\%WslUser%\.vscodium-server\bin (
    wsl -d %WslName% rm -rf ~/.vscodium-server/bin/*  
) 
wsl -d %WslName% mkdir -p ~/.vscodium-server/bin/%CodiumCommit%
wsl -d %WslName% wget -q -O ~/vscodium-reh-linux.tar.gz %DownloadUrl%
wsl -d %WslName% tar -xf ~/vscodium-reh-linux.tar.gz -C ~/.vscodium-server/bin/%CodiumCommit%/
wsl -d %WslName% rm ~/vscodium-reh-linux.tar.gz
echo Done!


@celikj
Copy link

celikj commented Aug 31, 2023

Ultimate solution to make WSL extension work, no need to modify any vendor files

Add the following lines to ~/.vscodium-server(-insiders)/server-env-setup:

# 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 .version "$product_json" | sed "s#\(-$QUALITY\)\?\$#.$release&#")
    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
    set -e
    fix_download
    set +e
fi
unset fix_download

Note requires jq to be installed
where is the ~/.vscodium-server(-insiders)/server-env-setup ?

@jeanp413
Copy link

jeanp413 commented Sep 3, 2023

I just published a new extension for wsl support, I only tested with windows 11 and wsl 2 though, please give it a try https://open-vsx.org/extension/jeanp413/open-remote-wsl

@jake-is-ESD-protected
Copy link

I just published a new extension for wsl support, I only tested with windows 11 and wsl 2 though, please give it a try https://open-vsx.org/extension/jeanp413/open-remote-wsl

I just tried your extension and it is the BOMB, thank you so much, keep it up! Works like a charm on my Win11 ARM device. Expect many more downloads

@kevinfiol
Copy link

I just published a new extension for wsl support, I only tested with windows 11 and wsl 2 though, please give it a try https://open-vsx.org/extension/jeanp413/open-remote-wsl

It is great! Thank you. I would make a note in the README that your WSL instance must have either curl or wget installed (fresh Debian WSL installs do not).

@tadghh
Copy link

tadghh commented Jan 6, 2024

Feel like this could be done with the dev containers extension aswell

@benzo-diazepine
Copy link

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

@tadghh
Copy link

tadghh commented Jan 26, 2024

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

Yeah that would be helpful, dev containers does work when you follow this guide btw

@celikj
Copy link

celikj commented Jan 28, 2024

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

Yeah that would be helpful, dev containers does work when you follow this guide btw

how does dev containers work?

@tadghh
Copy link

tadghh commented Jan 28, 2024

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

Yeah that would be helpful, dev containers does work when you follow this guide btw

how does dev containers work?

download the extension, create a new container, in the docker volume it creates follow the steps in here for wsl, replacing the is statement and the commit id. vscodium will need to have the same commit id ad thats checked when downloading new images. On a unrelated note the if statement for "isBuilt" doesnt happen with VSCode Canary so you would only need to replace the commit id.

There another way to do it where I used WSL, and had docker run through there and used the WSL extension too.

Overall its really buggy still. If theres someway to enable like "development mode" with codium so we can skip that "isBuilt" and also mock the latest commit id from official vscode that would get around this

@celikj
Copy link

celikj commented Jan 28, 2024

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

Yeah that would be helpful, dev containers does work when you follow this guide btw

how does dev containers work?

download the extension, create a new container, in the docker volume it creates follow the steps in here for wsl, replacing the is statement and the commit id. vscodium will need to have the same commit id ad thats checked when downloading new images. On a unrelated note the if statement for "isBuilt" doesnt happen with VSCode Canary so you would only need to replace the commit id.

There another way to do it where I used WSL, and had docker run through there and used the WSL extension too.

Overall its really buggy still. If theres someway to enable like "development mode" with codium so we can skip that "isBuilt" and also mock the latest commit id from official vscode that would get around this

I cant install the extension Unable to install extension 'ms-vscode-remote.remote-containers' as it is not compatible with VSCodium '1.85.2'.

@celikj
Copy link

celikj commented Jan 28, 2024

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

Yeah that would be helpful, dev containers does work when you follow this guide btw

how does dev containers work?

download the extension, create a new container, in the docker volume it creates follow the steps in here for wsl, replacing the is statement and the commit id. vscodium will need to have the same commit id ad thats checked when downloading new images. On a unrelated note the if statement for "isBuilt" doesnt happen with VSCode Canary so you would only need to replace the commit id.
There another way to do it where I used WSL, and had docker run through there and used the WSL extension too.
Overall its really buggy still. If theres someway to enable like "development mode" with codium so we can skip that "isBuilt" and also mock the latest commit id from official vscode that would get around this

I cant install the extension Unable to install extension 'ms-vscode-remote.remote-containers' as it is not compatible with VSCodium '1.85.2'.

ok I managed to install by changing the vsix file. done. someone should make a clean tutorial.

@tadghh
Copy link

tadghh commented Jan 28, 2024

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

Yeah that would be helpful, dev containers does work when you follow this guide btw

how does dev containers work?

download the extension, create a new container, in the docker volume it creates follow the steps in here for wsl, replacing the is statement and the commit id. vscodium will need to have the same commit id ad thats checked when downloading new images. On a unrelated note the if statement for "isBuilt" doesnt happen with VSCode Canary so you would only need to replace the commit id.
There another way to do it where I used WSL, and had docker run through there and used the WSL extension too.
Overall its really buggy still. If theres someway to enable like "development mode" with codium so we can skip that "isBuilt" and also mock the latest commit id from official vscode that would get around this

I cant install the extension Unable to install extension 'ms-vscode-remote.remote-containers' as it is not compatible with VSCodium '1.85.2'.

ok I managed to install by changing the vsix file. done. someone should make a clean tutorial.

Can you list what you changed? I just installed an older version of the Dev Containers extension to get around that issue

@celikj
Copy link

celikj commented Jan 29, 2024

At this point I wonder if it wouldn't be easier to allow overriding the COMMIT ID of codium.. if that is even possible

Yeah that would be helpful, dev containers does work when you follow this guide btw

how does dev containers work?

download the extension, create a new container, in the docker volume it creates follow the steps in here for wsl, replacing the is statement and the commit id. vscodium will need to have the same commit id ad thats checked when downloading new images. On a unrelated note the if statement for "isBuilt" doesnt happen with VSCode Canary so you would only need to replace the commit id.
There another way to do it where I used WSL, and had docker run through there and used the WSL extension too.
Overall its really buggy still. If theres someway to enable like "development mode" with codium so we can skip that "isBuilt" and also mock the latest commit id from official vscode that would get around this

I cant install the extension Unable to install extension 'ms-vscode-remote.remote-containers' as it is not compatible with VSCodium '1.85.2'.

ok I managed to install by changing the vsix file. done. someone should make a clean tutorial.

Can you list what you changed? I just installed an older version of the Dev Containers extension to get around that issue

in vsix open package.json and youwll see a version and change it to yours or a lower version.

@julihermes
Copy link

I just published a new extension for wsl support, I only tested with windows 11 and wsl 2 though, please give it a try https://open-vsx.org/extension/jeanp413/open-remote-wsl

Work for me using Remote Explorer in Activity Bar, but, the command codium from wsl not connecting, instead, open mounted wsl folder.
Is there any additional step to do?

@tadghh
Copy link

tadghh commented May 24, 2024

You can also change the WSL download template from within VSCodium
image

@CompeyDev
Copy link

Heads up - the latest WSL Extension v0.88.4 forbids sideloading altogether. See getcursor/cursor#2027.

@CompeyDev
Copy link

CompeyDev commented Oct 17, 2024

Ultimate solution to make WSL extension work, no need to modify any vendor files

Add the following lines to ~/.vscodium-server(-insiders)/server-env-setup:

# 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 .version "$product_json" | sed "s#\(-$QUALITY\)\?\$#.$release&#")
    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
    set -e
    fix_download
    set +e
fi
unset fix_download

Note requires jq to be installed

There's a small issue with this script, mainly the command exporting the file path on new cur;l; since the output directory is already /tmp it gets prepended to the path again leading to a path like /tmp/tmp/${filename}.

This can be fixed like so:

- export VSCODE_SERVER_TAR=$(curl -fLOJ "$url" --output-dir /tmp -w '/tmp/%{filename_effective}')
+ export VSCODE_SERVER_TAR=$(curl -fLOJ "$url" --output-dir /tmp -w '%{filename_effective}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests