VSCodium / vscodium

binary releases of VS Code without MS branding/telemetry/licensing
https://vscodium.com
MIT License
24.33k stars 1.03k forks source link

Make the WSL remote extension work in VS Codium #1265

Open wolfygit opened 1 year ago

wolfygit commented 1 year ago

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'

0reo commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

awebeer256 commented 1 year ago

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 commented 1 year ago

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

awebeer256 commented 1 year ago

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 commented 1 year ago

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

awebeer256 commented 1 year ago

@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:

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

FMGordillo commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

SuhasHebbar commented 1 year ago

@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)

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

timzuiddam commented 1 year ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 10 months ago

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 commented 6 months ago

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

benzo-diazepine commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 5 months ago

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 commented 4 months ago

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?

agreedSkiing commented 1 month ago

Contributing to this issue also with my workaround based on @Stivux code but done from the wsl installation.

  1. Windows: Install either open-remote-wsl or vsix-manager to install the offical ms-vscode-remote.remote-wsl (requires the config below and that VSIX Manager: Install externsion command has been executed from VSCodium in windows)

    vsix-manager-config ```json { "vsix.sources": { "ms": { "type": "marketplace", "serviceUrl": "https://marketplace.visualstudio.com/_apis/public/gallery", "itemUrl": "https://marketplace.visualstudio.com/items", "cacheUrl": "https://vscode.blob.core.windows.net/gallery/index" } }, "vsix.extensions": [ "ms:ms-vscode-remote.remote-wsl" ], "vsix.crons": { "update": "0 12 * * *" }, } ```
  2. WSL terminal: Install VSCodium in you wsl with the bash script below which is converted from @Stivux script

    #! /usr/bin/bash
    WINDOWS_CODIUM_PATH="/mnt/c/Program/VSCodium"
    WINDOWS_CODIUM_PRODUCT_JSON_PATH=$WINDOWS_CODIUM_PATH/resources/app/product.json
    WSL_CODIUM_TAR_PATH=$HOME/vscodium-reh-linux.tar.gz
    
    set_codium_repo() {
        CODIUM_QUALITY=$(jq ".[0].quality" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        if [[ "$CODIUM_QUALITY" == "stable" ]]; then
            CODIUM_REPO=vscodium
        elif [[ "$CODIUM_QUALITY" == "insider" ]]; then
            CODIUM_REPO=vscodium-insiders
        else
            echo Unknowm quality: "$CODIUM_QUALITY"
            exit 1
        fi
    }
    
    set_codium_download_version() {
        WINDOWS_CODIUM_RELEASE=$(jq ".[0].release" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        WINDOWS_CODIUM_VERSION=$(jq ".[0].version" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        if [[ "$CODIUM_QUALITY" == "stable" ]]; then
            CODIUM_DOWNLOAD_VERSION="$WINDOWS_CODIUM_VERSION"."$WINDOWS_CODIUM_RELEASE"
        elif [[ "$CODIUM_QUALITY" == "insider" ]]; then
            CODIUM_DOWNLOAD_VERSION="$WINDOWS_CODIUM_VERSION"."$WINDOWS_CODIUM_RELEASE"-"$CODIUM_QUALITY"
        fi
    }
    
    determin_wsl_distro_platform() {
        WSL_MACHINE=$(uname -m)
        if [[ "$WSL_MACHINE" == "x86_64" ]]; then
            CODIUM_PLATFORM=x64
        elif [[ "$WSL_MACHINE" == "armv7l" ]]; then
            CODIUM_PLATFORM=armhf
        elif [[ "$WSL_MACHINE" == "armv8l" ]]; then
            CODIUM_PLATFORM=armhf
        elif [[ "$WSL_MACHINE" == "arm64" ]]; then
            CODIUM_PLATFORM=arm64
        elif [[ "$WSL_MACHINE" == "aarch64" ]]; then
            CODIUM_PLATFORM=arm65
        else
            echo Unknown machine: "$WSL_MACHINE"
            exit 1
        fi
    }
    
    determin_wsl_kernel() {
        WSL_KERNEL=$(uname -s)
        WSL_KERNEL_LOWERCASE=${WSL_KERNEL,,}
        if [[ "$WSL_KERNEL_LOWERCASE" == "linux" ]]; then
            CODIUM_KERNEL=linux
        elif [[ "$WSL_KERNEL_LOWERCASE" == "alpine" ]]; then
            CODIUM_KERNEL=alpine
        elif [[ "$WSL_KERNEL_LOWERCASE" == "darwin" ]]; then
            CODIUM_KERNEL=darwin
        else
            echo Unkown kernal: "$WSL_KERNEL_LOWERCASE"
            exit 1
        fi
    }
    
    download_codium_artifact() {
        if [[ "$CODIUM_REPO" == "" ]]; then
            echo CODIUM_REPO not set
            exit 1
        fi
        if [[ "$CODIUM_DOWNLOAD_VERSION" == "" ]]; then
            echo CODIUM_DOWNLOAD_VERSION not set
            exit 1
        fi
        if [[ "$CODIUM_KERNEL" == "" ]]; then
            echo CODIUM_KERNEL not set
            exit 1
        fi
        if [[ "$CODIUM_PLATFORM" == "" ]]; then
            echo CODIUM_PLATFORM not set
            exit 1
        fi
        CODIUM_TAR=vscodium-reh-"$CODIUM_KERNEL"-"$CODIUM_PLATFORM"-"$CODIUM_DOWNLOAD_VERSION".tar.gz
        echo All required parameters are not empty starting download of "$CODIUM_TAR"
        wget -O "$WSL_CODIUM_TAR_PATH" https://github.com/VSCodium/"$CODIUM_REPO"/releases/download/"$CODIUM_DOWNLOAD_VERSION"/"$CODIUM_TAR"
    }
    
    install_codium_artificat() {
        CODIUM_COMMIT=$(jq ".[0].commit" -rs "$WINDOWS_CODIUM_PRODUCT_JSON_PATH")
        if [[ -d "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT" ]]; then
            echo Removing old artifact with same commit folder
            rm -fr "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT"
        fi
        echo Creating commit folder in "$HOME"/.vscodium-server/bin/
        mkdir -p "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT"
        tar -xf "$WSL_CODIUM_TAR_PATH" -C "$HOME"/.vscodium-server/bin/"$CODIUM_COMMIT"
        rm "$WSL_CODIUM_TAR_PATH"
        echo Installation done
    }
    
    fail_if_jq_is_missing() {
      if [[ ! $(which jq) ]]; then
        echo "Missing jq install."
        exit 1
      fi
    }
    
    fail_if_jq_is_missing
    set_codium_repo
    set_codium_download_version
    determin_wsl_distro_platform
    determin_wsl_kernel
    download_codium_artifact
    install_codium_artificat
  3. Depending on what extension you installed in step 1 do either a or b below. a. open-remote-wsl: Use the remote explorer in your vscodium to connect to the wsl distrobution b. vsix-manager + ms-vscode-remote.remote-wsl: Either use the remote explorer in your vscodium to connect to the wsl distrobution or use the a terminal that i connected to the wsl distrobution and write
    codium .

P.S. I have only tested my code on Win 10 with a system install of VSCodium (1.89.1.24130) with Ubuntu-22.04 and the wsl version below

> wsl --version
WSL-version: 2.1.0.0
Kernelversion: 5.15.137.3-1
WSLg-version: 1.0.59
MSRDC-version: 1.2.4677
Direct3D-version: 1.611.1-81528511
DXCore-version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows-version: 10.0.19045.4412
tadghh commented 1 month ago

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

agreedSkiing commented 1 month ago

@tadghh wish that worked for me with open-remote-wsl but for some reason the download fails :/ https://github.com/jeanp413/open-remote-wsl/issues/9