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

Support for Linux #606

Open
groninge01 opened this issue Jan 7, 2024 · 13 comments
Open

Support for Linux #606

groninge01 opened this issue Jan 7, 2024 · 13 comments
Labels
enhancement New feature or request

Comments

@groninge01
Copy link

I'd like to run Rabby Desktop on linux. If you have any pointers to how this can be accomplished I can maybe try to add this myself.

@groninge01 groninge01 added the enhancement New feature or request label Jan 7, 2024
@gagarin55
Copy link

gagarin55 commented Jan 8, 2024

Electron supports AppImage for Linux, I wonder why there is no Linux distro

@unixpariah
Copy link

I recommend cloning the repo and compiling it yourself with "npm run build", if they haven't released version for linux yet they probably won't release it at all, it takes 0 effort to do that with electron

@groninge01
Copy link
Author

I recommend cloning the repo and compiling it yourself with "npm run build", if they haven't released version for linux yet they probably won't release it at all, it takes 0 effort to do that with electron

Yeah, unfortunately it is not as simple as that :(

@groninge01
Copy link
Author

groninge01 commented Jan 14, 2024

@richardo2016x is this on the roadmap and/or do you have any pointers for me to implement this?

@richardo2016x
Copy link
Collaborator

@richardo2016x is this on the roadmap and/or do you have any pointers for me to implement this?

Thank you for your love of our product. Unfortunately we currently do not have plans to release a Linux version. Please consider trying the versions available on other platforms.

@groninge01
Copy link
Author

@richardo2016x is this on the roadmap and/or do you have any pointers for me to implement this?

Thank you for your love of our product. Unfortunately we currently do not have plans to release a Linux version. Please consider trying the versions available on other platforms.

Thanks for the info. I'll look into setting up a VM on Linux then.

@unixpariah
Copy link

@richardo2016x is this on the roadmap and/or do you have any pointers for me to implement this?

Thank you for your love of our product. Unfortunately we currently do not have plans to release a Linux version. Please consider trying the versions available on other platforms.

Can we get more details on why is it not cross platform? I managed to compile it to .AppImage with

npm i && npm run postinstall && npm run build && npm exec electron-builder --linux 

but when running the appimage I get the module not found error

@groninge01
Copy link
Author

@richardo2016x is this on the roadmap and/or do you have any pointers for me to implement this?

Thank you for your love of our product. Unfortunately we currently do not have plans to release a Linux version. Please consider trying the versions available on other platforms.

Can we get more details on why is it not cross platform? I managed to compile it to .AppImage with

npm i && npm run postinstall && npm run build && npm exec electron-builder --linux 

but when running the appimage I get the module not found error

When I run the build I get a lot of webpack errors (unused variables, etc). In which branch are you running the build?

@unixpariah
Copy link

@richardo2016x is this on the roadmap and/or do you have any pointers for me to implement this?

Thank you for your love of our product. Unfortunately we currently do not have plans to release a Linux version. Please consider trying the versions available on other platforms.

Can we get more details on why is it not cross platform? I managed to compile it to .AppImage with

npm i && npm run postinstall && npm run build && npm exec electron-builder --linux 

but when running the appimage I get the module not found error

When I run the build I get a lot of webpack errors (unused variables, etc). In which branch are you running the build?

In main branch, I had plenty of errors too but simply ignored them and compiled it. The source code seems like a mess, run 'npm run lint' for example and you'll see hundreds of warnings

@CodeShakingSheep
Copy link

CodeShakingSheep commented Mar 1, 2024

I tried to run Rabby Desktop in "Bottles" on Ubuntu 22.04 LTS. I could install rabby with the installer. However, when I want to launch it afterwards, I run into this error and Rabby Desktop won't launch.

[mainprocess]  [cLog]  [doFetchDynamicConfig] start fetch DynamicConfig...
wine: Call from 00000001700308E0 to unimplemented function CFGMGR32.dll.CM_Register_Notification, aborting
[236:0301/150153.463:ERROR:crashpad_client_win.cc(844)] not connected

My bottle runs with Win64 and soda-8.0.2 having mono, dotnet40 and dotnet48 installed. Regarding the error I read

However, I still couldn't get it to work. Could anybody run Rabby Desktop successfully in Bottles (or build it natively as Electron app)?

Edit: I also installed Rabby directly in Wine (without using bottles) and today suddenly it worked. 😄
image

@CodeShakingSheep
Copy link

I also managed to compile the app ignoring all the webpack errors and built the AppImage. I used main branch publish/prod as well. However, when running the AppImage I run into this error.

~/Repositories/Github/RabbyDesktop/dist$ ./rabby-desktop-0.36.5.AppImage 
(node:27053) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `rabby-desktop --trace-warnings ...` to show where the warning was created)
A JavaScript error occurred in the main process
Uncaught Exception:
/tmp/.mount_rabby-ceC6ne/resources/app.asar/src/main/main.ts:4
import './streams/pre-bootstrap';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1185:20)
    at Module._compile (node:internal/modules/cjs/loader:1227:27)
    at Object..js (node:internal/modules/cjs/loader:1326:10)
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at node:internal/modules/cjs/loader:967:12
    at Function._load (node:electron/js2c/asar_bundle:2:13327)
    at node:electron/js2c/browser_init:2:122709
    at node:electron/js2c/browser_init:2:122912
    at node:electron/js2c/browser_init:2:122916
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)

Does anybody know how to fix it?

@unixpariah
Copy link

You could either add "type": "module" in package.json or use require instead of import in the file that the error was thrown, although as I remember after doing either of those, a new error appeared. Info from devs what exactly causes issues on linux would be lovely

@CodeShakingSheep
Copy link

CodeShakingSheep commented Mar 5, 2024

I was just playing around with this and could take it a bit further. These were the adoptions I made:

  1. Change Electron build command to consider electron builder config
    Running npm exec electron-builder --linux is not working correctly as it doesn't take into account electron-builder.config.js. So, instead I ran npm run package. However, as there is also a prepackage script in package.json which is automatically executed and contains npm run build which finishes with errors, the actual package script was never executed. What worked was to remove prepackage from npm scripts in package.json. Then I ran npm run build separately, let it finish with errors and then ran npm run package.

  2. Fixing icon directory doesn't contain icons error
    When running npm run package for the first time I ran into the mentioned error. The fix was fairly simple. I just copied assets/icon.png to assets/icons/icon.png. Then ran npm run build again and npm run package. This successfully builds the AppImage.

    Note, that as per electron config the AppImage will be located in release/build-linux-x64-reg. From there it can be executed. Also, the Module not found error isn't present anymore when building the app like this.

  3. Fixing RABBY_DESKTOP_KR_PWD not found
    When running the AppImage the first time, I ran into the mentioned error. I could fix this by adopting _base.ts by changing this

// export const RABBY_DESKTOP_KR_PWD = '<set password here>';
export const RABBY_DESKTOP_KR_PWD = IS_RUNTIME_PRODUCTION
  ? (process as any).RABBY_DESKTOP_KR_PWD!
  : process.env.RABBY_DESKTOP_KR_PWD;`

to that

export const RABBY_DESKTOP_KR_PWD = 'mypwd';
//export const RABBY_DESKTOP_KR_PWD = IS_RUNTIME_PRODUCTION
//  ? (process as any).RABBY_DESKTOP_KR_PWD!
//  : process.env.RABBY_DESKTOP_KR_PWD;`

Then ran npm run build again and npm run package.

  1. Fixing /bin/sh: 1: scutil: not found error
    When running the AppImage again, this error was thrown Error: Command failed: scutil --proxy. I investigated the source code a bit and figured that this is somehow expected as proxy settings are retrieved differently on operating systems. In systemConfig.ts there are two functions getDarwinSystemHttpProxySettings() for macOS and getWin32SystemHttpProxySettings() for Windows.

    To fix the error I added this var const isLinux = process.platform === 'linux'; and this function async function getLinuxSystemHttpProxySettings(): Promise<ISimpleProxySetting | null> { return null; } and adopted result.config to result.config = isWin32 ? await getWin32SystemHttpProxySettings() : isLinux ? await getLinuxSystemHttpProxySettings() : await getDarwinSystemHttpProxySettings();. So the whole systemConfig.ts file looks like this:

import child_process from 'child_process';

import {
  type ProxySetting,
  type Protocol,
  getProxyWindows,
} from 'get-proxy-settings';

import { coerceNumber } from '@/isomorphic/primitive';
import { parseScUtilProxyOutput } from '@/isomorphic/parser';

const isWin32 = process.platform === 'win32';
const isLinux = process.platform === 'linux';

const command = 'scutil --proxy';

type ISimpleProxySetting = {
  host: ProxySetting['host'];
  port: ProxySetting['port'] | number;
  protocol: ProxySetting['protocol'];
  // TODO: use those two fields in proper case if provided
  credentials?: ProxySetting['credentials'];
  bypassAddrs?: string[];
};

async function getDarwinSystemHttpProxySettings(): Promise<ISimpleProxySetting | null> {
  try {
    const output = child_process.execSync(command);
    const settings = parseScUtilProxyOutput(output.toString());

    if (settings.HTTPEnable) {
      return {
        protocol: 'http' as Protocol,
        host: settings.HTTPProxy as string,
        port: settings.HTTPPort as number,
      };
    }
    if (settings.HTTPSEnable) {
      return {
        protocol: 'http' as Protocol,
        host: settings.HTTPSProxy as string,
        port: settings.HTTPSPort as number,
      };
    } /* else if (settings.SOCKSEnable) {
      return {
        protocol: 'socks' as Protocol,
        host: settings.SOCKSProxy as string,
        port: settings.SOCKSPort as number,
      }
    } */
  } catch (err) {
    console.error(err);
  }

  return null;
}

async function getWin32SystemHttpProxySettings(): Promise<ISimpleProxySetting | null> {
  const settings = await getProxyWindows();

  return settings?.https || settings?.http || null;
}

async function getLinuxSystemHttpProxySettings(): Promise<ISimpleProxySetting | null> {
  // TODO: Implement
  return null;
}

export type ISysProxyInfo = {
  config: ISimpleProxySetting | null;
  systemProxySettings: IAppProxyConf['systemProxySettings'];
};
const state: {
  fetched: boolean;
  config: ISysProxyInfo['config'];
} = {
  fetched: false,
  config: null,
};
export async function getSystemProxyInfo(forceReload = false) {
  const result: ISysProxyInfo = {
    config: state.config ? { ...state.config } : null,
    systemProxySettings: undefined,
  };
  if (!state.fetched || forceReload) {
    result.config = isWin32
      ? await getWin32SystemHttpProxySettings()
      : isLinux ? await getLinuxSystemHttpProxySettings() : await getDarwinSystemHttpProxySettings();

    state.fetched = true;
  }

  if (result.config) {
    const port = coerceNumber(result.config.port, 0);

    result.systemProxySettings = {
      protocol: result.config.protocol as 'http',
      host: result.config.host,
      port,
    };
  } else {
    result.systemProxySettings = undefined;
  }

  return result;
}

Then ran npm run build again and npm run package. This fixes the error.

  1. Running into error Extension directory not found
    This is the complete error:
Error: Extension directory not found: /tmp/.mount_Rabby lIQBD2/resources/assets/desktop_shell
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Extension directory not found: /tmp/.mount_Rabby lIQBD2/resources/assets/desktop_shell
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[62356:0305/122423.748177:ERROR:nss_util.cc(357)] After loading Root Certs, loaded==false: NSS error code: -8018

Indeed, the desktop_shell directory isn't present. I saw that */desktop_shell/* is present in .gitignore. l checked the directory out in my Windows build and just copied it over to the repo's assets directory. Then ran npm run package again and executed the AppImage. This fixed the error. I was just wondering why */desktop_shell/* is not checked in to the repository. Basically it just contains some HTML, CSS and JS files and a bunch of svg icons for different chains / cryptocurrencies and a matomo client file. Any comments on that from the dev team?

Edit: Managed to get one step further from 5. to 6. 😄

  1. Running into error Error: ERR_FILE_NOT_FOUND (-6) loading 'rabby-internal://local/popup-view.html#/rabby-notification-gasket'
    This is the complete error:
(node:27658) electron: Failed to load URL: rabby-internal://local/popup-view.html#/rabby-notification-gasket with error: ERR_FILE_NOT_FOUND
10:03:35.034 › Error: ERR_FILE_NOT_FOUND (-6) loading 'rabby-internal://local/popup-view.html#/rabby-notification-gasket'
    at rejectAndCleanup (node:electron/js2c/browser_init:2:85498)
    at WebContents.failListener (node:electron/js2c/browser_init:2:85711)
    at WebContents.emit (node:events:513:28)
    at WebContents.emit (node:domain:489:12)
    at e.emit (/tmp/.mount_Rabby zBKxH7/resources/app.asar/dist/main/main.js:2:338379)
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: ERR_FILE_NOT_FOUND (-6) loading 'rabby-internal://local/popup-view.html#/rabby-notification-gasket'
    at rejectAndCleanup (node:electron/js2c/browser_init:2:85498)
    at WebContents.failListener (node:electron/js2c/browser_init:2:85711)
    at WebContents.emit (node:events:513:28)
    at WebContents.emit (node:domain:489:12)
    at e.emit (/tmp/.mount_Rabby zBKxH7/resources/app.asar/dist/main/main.js:2:338379)

With this one, I'm stuck. I didn't manage to fix it unfortunately. Would be amazing if someone from the dev team can comment on that. May be @richardo2016x ? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants