NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.36k stars 14.31k forks source link

JetBrains applications/products installed using JetBrains Toolbox won't start #240444

Open x80486 opened 1 year ago

x80486 commented 1 year ago

Describe the Bug

I recently installed jetbrains-toolbox with Home Manager. I then installed at least 3 applications I commonly use, using JetBrains Toolbox...and not a single one will start.

Steps To Reproduce

  1. Install jetbrains-toolbox
  2. Open JetBrains Toolbox and install DataGrip (or any other application/product)
  3. Start the application

Expected Behavior

Applications installed should work.

Additional Context

This is the error I'm getting in the journal:

Jun 28 18:12:46 uplink jetbrains-idea.desktop[59365]: /home/x80486/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9161.38/bin/idea.sh: line 171: /home/x80486/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9161.38/jbr/bin/java: cannot execute: required file not found

And something similar if I try to just run the shell script directly:

[x80486@uplink:~/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9161.38/bin]$ ./idea.sh 
./idea.sh: line 171: /home/x80486/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/231.9161.38/jbr/bin/java: cannot execute: required file not found

Notify maintainers

@AnatolyPopov

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[x80486@uplink:~]$ nix-shell -p nix-info --run "nix-info -m"
this path will be fetched (0.01 MiB download, 0.05 MiB unpacked):
  /nix/store/5wdlffjhcr4i43sfajxcvx3lvnkryh5y-stdenv-linux
copying path '/nix/store/5wdlffjhcr4i43sfajxcvx3lvnkryh5y-stdenv-linux' from 'https://cache.nixos.org'...
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.35, NixOS, 23.05 (Stoat), 23.05.1375.9790f3242da`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - channels(x80486): `"home-manager-23.05.tar.gz"`
 - channels(root): `"nixos-23.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
nazarewk commented 1 year ago

I'm not sure what happened, but after recent system update and rm -rf ~/.cache/JetBrains/Fleet it is launching for me, but only through Jetbrains Toolbox - the script doesn't work.

It seems to start in it's own bwrap environment

x80486 commented 1 year ago

I see what you describe. Not sure what's going on with Toolbox, but the applications are able to start if started, as you said, from Toolbox itself. Basically the desktop icon is useless for the time being.

Feel free to let this one open if you have plans to take a look at it at some point. Thanks for the tip! :wave:

AnatolyPopov commented 1 year ago

As far as I understand the reason is that you are using JetBrains JDK that is downloaded into your home directory. It is not properly patched to see the all the needed system library and interpreter and has default paths in ELF file. That's the reason for file not found. When you start your ide from JB Toolbox it's started via appimage and the appimage environment has all the required paths, so dependencies of jvm are resolvable there. So this appimage env is propagated to ide and because of that it magically works. I was trying to solve this issue for quite long time (before I discovered how to run Toolbox) and all my attempts were unsuccessful.

mattiasflodin commented 1 year ago

I'm seeing this problem also. I have not downloaded anything "manually" - I installed the NixOS package for jetbrains-toolbox and then used that for installing JetBrains applications (as is pretty much the whole point of it).

Applications work when started by JetBrains Toolbox because they are then launched inside the bwrap environment. The problem is the .desktop files created by Jetbrains Toolbox just try to start the java binary without the bwrap environment.

I realize it is messy to live-patch .desktop files that JetBrains Toolbox creates. But if NixOS at least provded a way for me to launch applications inside of the same environment as JetBrains Toolbox (similar to the steam-run package) then I could create my own .desktop files or shell scripts to start the developer tools without having to click my way through the Toolbox every time.

mattiasflodin commented 1 year ago

This is aggravated by the fact that the Jetbrains Toolbox tray icon does not display properly in the polybar tray, so if you ever close the Toolbox window you have to start another Toolbox process even though the previous one is still running.

Valpha80 commented 12 months ago

New to NixOS here, and I have the same behaviour.

Fresh install of "jetbrains-toolbox" through systemPackages in /etc/nixos/configuration.nix

I installed RustRover from the ToolBox and whenever I try to start it with the "application shortcut" it doesn't start. I need to start it from Jetbrains Toolbox for it to start properly.

haraldh commented 8 months ago
  programs.nix-ld.enable = true;
  programs.nix-ld.libraries = with pkgs; [
    curl
    expat
    fontconfig
    freetype
    fuse
    fuse3
    glib
    icu
    libclang.lib
    libdbusmenu
    libxcrypt-legacy
    libxml2
    nss
    openssl
    python3
    stdenv.cc.cc
    xorg.libX11
    xorg.libXcursor
    xorg.libXext
    xorg.libXi
    xorg.libXrender
    xorg.libXtst
    xz
    zlib
  ];

works for me with rustrover...

brcha commented 8 months ago
  programs.nix-ld.enable = true;
  programs.nix-ld.libraries = with pkgs; [
    curl
    expat
    fontconfig
    freetype
    fuse
    fuse3
    glib
    icu
    libclang.lib
    libdbusmenu
    libxcrypt-legacy
    libxml2
    nss
    openssl
    python3
    stdenv.cc.cc
    xorg.libX11
    xorg.libXcursor
    xorg.libXext
    xorg.libXi
    xorg.libXrender
    xorg.libXtst
    xz
    zlib
  ];

works for me with rustrover...

First time I hear of nix-ld. Thanks, I will look into it and use it to enable apps. It's mostly probable that your setup works for other jetbrains apps as well, since they are all one app, anyway.

captainepoch commented 8 months ago

It somehow works, but when using Android Studio, I cannot setup the JDK path to the JAVA_HOME env. variable, which is possible using the android-studio package. It doesn't even show at the JDK version selector.

@haraldh Do you happen to know how to fix this with your setup?

haraldh commented 8 months ago

You can try with all appimage packages as defined in https://github.com/NixOS/nixpkgs/blob/3030f185ba6a4bf4f18b87f345f104e6a6961f34/pkgs/build-support/appimage/default.nix#L95-L212

e.g.

    programs.nix-ld.libraries = with pkgs; [
      SDL
      SDL2
      SDL2_image
      SDL2_mixer
      SDL2_ttf
      SDL_image
      SDL_mixer
      SDL_ttf
      alsa-lib
      at-spi2-atk
      at-spi2-core
      atk
      bzip2
      cairo
      cups
      curlWithGnuTls
      dbus
      dbus-glib
      desktop-file-utils
      e2fsprogs
      expat
      flac
      fontconfig
      freeglut
      freetype
      fribidi
      fuse
      fuse3
      gdk-pixbuf
      glew110
      glib
      gmp
      gst_all_1.gst-plugins-base
      gst_all_1.gst-plugins-ugly
      gst_all_1.gstreamer
      gtk2
      harfbuzz
      icu
      keyutils.lib
      libGL
      libGLU
      libappindicator-gtk2
      libcaca
      libcanberra
      libcap
      libclang.lib
      libdbusmenu
      libdrm
      libgcrypt
      libgpg-error
      libidn
      libjack2
      libjpeg
      libmikmod
      libogg
      libpng12
      libpulseaudio
      librsvg
      libsamplerate
      libthai
      libtheora
      libtiff
      libudev0-shim
      libusb1
      libuuid
      libvdpau
      libvorbis
      libvpx
      libxcrypt-legacy
      libxkbcommon
      libxml2
      mesa
      nspr
      nss
      openssl
      p11-kit
      pango
      pixman
      python3
      speex
      stdenv.cc.cc
      tbb
      udev
      vulkan-loader
      wayland
      xorg.libICE
      xorg.libSM
      xorg.libX11
      xorg.libXScrnSaver
      xorg.libXcomposite
      xorg.libXcursor
      xorg.libXdamage
      xorg.libXext
      xorg.libXfixes
      xorg.libXft
      xorg.libXi
      xorg.libXinerama
      xorg.libXmu
      xorg.libXrandr
      xorg.libXrender
      xorg.libXt
      xorg.libXtst
      xorg.libXxf86vm
      xorg.libpciaccess
      xorg.libxcb
      xorg.xcbutil
      xorg.xcbutilimage
      xorg.xcbutilkeysyms
      xorg.xcbutilrenderutil
      xorg.xcbutilwm
      xorg.xkeyboardconfig
      xz
      zlib
    ];
meenzen commented 8 months ago

You can try with all appimage packages as defined in

https://github.com/NixOS/nixpkgs/blob/3030f185ba6a4bf4f18b87f345f104e6a6961f34/pkgs/build-support/appimage/default.nix#L95-L212

e.g.

    programs.nix-ld.libraries = with pkgs; [
      SDL
      SDL2
      SDL2_image
      SDL2_mixer
      SDL2_ttf
      SDL_image
      SDL_mixer
      SDL_ttf
      alsa-lib
      at-spi2-atk
      at-spi2-core
      atk
      bzip2
      cairo
      cups
      curlWithGnuTls
      dbus
      dbus-glib
      desktop-file-utils
      e2fsprogs
      expat
      flac
      fontconfig
      freeglut
      freetype
      fribidi
      fuse
      fuse3
      gdk-pixbuf
      glew110
      glib
      gmp
      gst_all_1.gst-plugins-base
      gst_all_1.gst-plugins-ugly
      gst_all_1.gstreamer
      gtk2
      harfbuzz
      icu
      keyutils.lib
      libGL
      libGLU
      libappindicator-gtk2
      libcaca
      libcanberra
      libcap
      libclang.lib
      libdbusmenu
      libdrm
      libgcrypt
      libgpg-error
      libidn
      libjack2
      libjpeg
      libmikmod
      libogg
      libpng12
      libpulseaudio
      librsvg
      libsamplerate
      libthai
      libtheora
      libtiff
      libudev0-shim
      libusb1
      libuuid
      libvdpau
      libvorbis
      libvpx
      libxcrypt-legacy
      libxkbcommon
      libxml2
      mesa
      nspr
      nss
      openssl
      p11-kit
      pango
      pixman
      python3
      speex
      stdenv.cc.cc
      tbb
      udev
      vulkan-loader
      wayland
      xorg.libICE
      xorg.libSM
      xorg.libX11
      xorg.libXScrnSaver
      xorg.libXcomposite
      xorg.libXcursor
      xorg.libXdamage
      xorg.libXext
      xorg.libXfixes
      xorg.libXft
      xorg.libXi
      xorg.libXinerama
      xorg.libXmu
      xorg.libXrandr
      xorg.libXrender
      xorg.libXt
      xorg.libXtst
      xorg.libXxf86vm
      xorg.libpciaccess
      xorg.libxcb
      xorg.xcbutil
      xorg.xcbutilimage
      xorg.xcbutilkeysyms
      xorg.xcbutilrenderutil
      xorg.xcbutilwm
      xorg.xkeyboardconfig
      xz
      zlib
    ];

I can confirm this works for:

haraldh commented 8 months ago

libsecret is also nice to have

meenzen commented 8 months ago

When I launch an IDE using the jetbrains-toolbox app git works fine. When I start the IDE externally, any git server communication fails with the following error:

unable to access 'https://git.example.org/foo/bar.git/': server certificate verification failed. CAfile: none CRLfile: none

Is there a workaround to make the system CA bundle available?

haraldh commented 8 months ago

Does setting export SSL_CERT_FILE="/etc/ssl/certs/ca-bundle.crt" help?

haraldh commented 8 months ago

or NIX_SSL_CERT_FILE

meenzen commented 8 months ago

I've set both variables, it doesn't help unfortunately.

nixos-discourse commented 2 months ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/latest-intellij-idea-ultimate/43103/10