JetpackDuba / Gitnuro

A FOSS Git multiplatform client for newbies and pros

Home Page:https://gitnuro.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash on starting JAR on NixOS 23.11

julius-boettger opened this issue · comments

Describe the bug
After upgrading from NixOS 23.05 to NixOS 23.11 Gitnuro instantly crashes on start. I did not change anything else concerning my system, I simply upgraded it. Gitnuro worked as expected before. Now I get:

> gitnuro
log4j:WARN No appenders could be found for logger (org.slf4j).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/julius/.skiko/394308fc04ec076aa7c8ef954bd724cf1f5e7f1fac0f2c83c9c42f8897c7e3fc/libskiko-linux-x64.so: libGL.so.1: cannot open shared object file: No such file or directory
	at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
	at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
	at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2404)
	at java.base/java.lang.Runtime.load0(Runtime.java:785)
	at java.base/java.lang.System.load(System.java:2011)
	at org.jetbrains.skiko.Library.loadLibraryOrCopy(Library.kt:20)
	at org.jetbrains.skiko.Library.findAndLoad(Library.kt:113)
	at org.jetbrains.skiko.Library.load(Library.kt:59)
	at org.jetbrains.skia.impl.Library$Companion.staticLoad(Library.jvm.kt:12)
	at org.jetbrains.skia.Data.<clinit>(Data.kt:60)
	at androidx.compose.ui.res.DesktopSvgResources_desktopKt.loadSvgPainter(DesktopSvgResources.desktop.kt:55)
	at androidx.compose.ui.res.PainterResources_desktopKt.rememberSvgResource(PainterResources.desktop.kt:82)
	at androidx.compose.ui.res.PainterResources_desktopKt.painterResource(PainterResources.desktop.kt:68)
	at androidx.compose.ui.res.PainterResources_desktopKt.painterResource(PainterResources.desktop.kt:57)
	at com.jetpackduba.gitnuro.App$start$1.invoke(App.kt:129)
	at com.jetpackduba.gitnuro.App$start$1.invoke(App.kt:108)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:117)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
	at androidx.compose.ui.window.Application_desktopKt$application$1$1.invoke(Application.desktop.kt:115)
	at androidx.compose.ui.window.Application_desktopKt$application$1$1.invoke(Application.desktop.kt:114)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:117)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1$1.invoke(Application.desktop.kt:226)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1$1.invoke(Application.desktop.kt:225)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
	at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:221)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2$1.invoke(Application.desktop.kt:219)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:108)
	at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:35)
	at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:39)
	at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3341)
	at androidx.compose.runtime.ComposerImpl.composeContent$runtime(Composer.kt:3274)
	at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:588)
	at androidx.compose.runtime.Recomposer.composeInitial$runtime(Recomposer.kt:1013)
	at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:520)
	at androidx.compose.ui.window.Application_desktopKt$awaitApplication$2$1$2.invokeSuspend(Application.desktop.kt:219)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

Tested on awesome window manager (Xorg) and Hyprland (Wayland), same results.

To Reproduce

  1. Be on NixOS 23.11
  2. Try to start Gitnuro 1.3.1

Expected behavior
Gitnuro should start as expected (without crashing).

Desktop

  • OS: NixOS 23.11 (Linux)
  • Version: 1.3.1

Are you using the plain JAR or Flatpak?

I am using the plain JAR.
More specifically I am using the following Nix Derivation to install Gitnuro 1.3.1:

{ stdenv
, fetchurl
, makeWrapper
, copyDesktopItems
, makeDesktopItem
, jre
}:

stdenv.mkDerivation rec {
  pname = "gitnuro";
  version = "1.3.1";

  src = fetchurl {
    url = "https://github.com/JetpackDuba/Gitnuro/releases/download/v${version}/Gitnuro-linux-x86_64-${version}.jar";
    hash = "sha256-7yne9dD/7VT+H4tIBJvpOf8ksECCpoNAa8TSmFmjYMw=";
  };

  icon = fetchurl {
    url = "https://raw.githubusercontent.com/JetpackDuba/Gitnuro/main/icons/logo.svg";
    hash = "sha256-QGJcWTSJesIpDArOWiS3Kn1iznzeMFzvqS+CuNXh3as=";
  };

  dontUnpack = true;

  nativeBuildInputs = [
    makeWrapper
    copyDesktopItems
  ];

  installPhase = ''
    runHook preInstall
    makeWrapper ${jre}/bin/java $out/bin/gitnuro --add-flags "-jar $src"
    install -Dm444 $icon $out/share/icons/hicolor/scalable/apps/com.jetpackduba.Gitnuro.svg
    runHook postInstall
  '';

  desktopItems = [
    (makeDesktopItem {
      name = "Gitnuro";
      exec = "gitnuro";
      icon = "com.jetpackduba.Gitnuro";
      desktopName = "Gitnuro";
      categories = [ "Development" ];
      comment = "A FOSS Git multiplatform client based on Compose and JGit";
    })
  ];
}

Okay, so I just tried the Flatpak instead of the JAR. It works, although I get some warnings similar to the errors when trying to start the JAR:

> flatpak run com.jetpackduba.Gitnuro
log4j:WARN No appenders could be found for logger (org.slf4j).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

You can ignore these messages, as the logging is reconfigured at runtime after the first initialization.

As for why does the JAR fail, it seems that libGL was removed from your system during the upgrade process. Perhaps installing it back will fix it? The Flatpak version works because flatpak probably includes it by default.

I tried installing libGL, libGLU and libglibutil from nixpkgs, but that doesn't change anything, sadly.

I also just noticed that the Flatpak version does not allow me to open a repository located in /etc, which I have used with the Gitnuro JAR up until now with no problems. I get the following error dialogue:
image
And the terminal output

2023-12-04 15:38:26 INFO  slf4j:8 - TabViewModel - Trying to open repository /etc/dotfiles
org.eclipse.jgit.errors.NoWorkTreeException: Bare Repository has neither a working tree, nor an index
	at org.eclipse.jgit.lib.Repository.getWorkTree(Repository.java:1582)
	at com.jetpackduba.gitnuro.viewmodels.TabViewModel$openRepository$1.invokeSuspend(TabViewModel.kt:161)
	at com.jetpackduba.gitnuro.viewmodels.TabViewModel$openRepository$1.invoke(TabViewModel.kt)
	at com.jetpackduba.gitnuro.viewmodels.TabViewModel$openRepository$1.invoke(TabViewModel.kt)
	at com.jetpackduba.gitnuro.git.TabState$safeProcessingWithoutGit$job$1.invokeSuspend(TabState.kt:189)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
	at kotlinx.coroutines.internal.LimitedDispatcher.run(LimitedDispatcher.kt:42)
	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:95)
	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

Is this an intended part of Flatpak's sandboxing, or does it deserve its own issue here?

It's part of Flatpak's sandboxing, I think that you can use flatseal to add permission to the directory.

I tried installing libGL, libGLU and libglibutil from nixpkgs, but that doesn't change anything, sadly.

Can you run this to list the installed libs? ldconfig -p | grep libGL

It's part of Flatpak's sandboxing, I think that you can use flatseal to add permission to the directory.

Alright, then I will try that.

Can you run this to list the installed libs? ldconfig -p | grep libGL

This command seems to run into an issue similar to Gitnuro's:

> ldconfig -p | grep libGL
ldconfig: Can't open cache file /nix/store/qn3ggz5sf3hkjs2c797xf7nan3amdxmp-glibc-2.38-27/etc/ld.so.cache
: No such file or directory

I found something about this behaviour in this issue. Although I don't fully understand what this is about, it seems like NixOS intentionally does not have an ld.cache, which is why the command fails.

If this is the case, then I don't understand why I'm running into this issue for the first time now, as this is quite an old issue.

Ah I wanted you to run this command just to list the installed libraries, nothing related to Gitnuro.

I'm not familiar enough with NixOS, but I guess that using a find command would be possible too: sudo find / -name "libGL.so*". Just wanted to verify if the dependency is properly installed.

find works. Keep in mind that directories in /nix/store are managed by NixOS and contain a hash of their content in the directory name.

> sudo find / -name "libGL.so*"
find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/run/user/1000/doc’: Permission denied
find: ‘/proc/1742/task/1742/net’: Invalid argument
find: ‘/proc/1742/net’: Invalid argument
/var/lib/flatpak/runtime/org.freedesktop.Platform/x86_64/22.08/12e6f0416b1a1c32dc29994ee8068725e114198bd7cee570039df3f89bef5167/files/lib/x86_64-linux-gnu/libGL.so.1
/var/lib/flatpak/runtime/org.freedesktop.Platform/x86_64/22.08/12e6f0416b1a1c32dc29994ee8068725e114198bd7cee570039df3f89bef5167/files/lib/x86_64-linux-gnu/libGL.so.1.7.0
/var/lib/flatpak/runtime/org.gnome.Platform/x86_64/45/22e0bd575bdd7f0391fe19e346627198d00d1726957675dfad61a26476122dcb/files/lib/x86_64-linux-gnu/libGL.so.1
/var/lib/flatpak/runtime/org.gnome.Platform/x86_64/45/22e0bd575bdd7f0391fe19e346627198d00d1726957675dfad61a26476122dcb/files/lib/x86_64-linux-gnu/libGL.so.1.7.0
/nix/store/36hfsb2jjzhn5pgmh140vjxh97spmql3-libglvnd-1.6.0/lib/libGL.so.1
/nix/store/36hfsb2jjzhn5pgmh140vjxh97spmql3-libglvnd-1.6.0/lib/libGL.so
/nix/store/36hfsb2jjzhn5pgmh140vjxh97spmql3-libglvnd-1.6.0/lib/libGL.so.1.7.0
/nix/store/y1cpinq9fs2gkmxbdm9fcnygyyszjvyd-user-environment/lib/libGL.so.1
/nix/store/y1cpinq9fs2gkmxbdm9fcnygyyszjvyd-user-environment/lib/libGL.so
/nix/store/y1cpinq9fs2gkmxbdm9fcnygyyszjvyd-user-environment/lib/libGL.so.1.7.0
/nix/store/83rzx3ki1rqkl5lnz0nzq076w996f4rq-user-environment/lib/libGL.so.1
/nix/store/83rzx3ki1rqkl5lnz0nzq076w996f4rq-user-environment/lib/libGL.so
/nix/store/83rzx3ki1rqkl5lnz0nzq076w996f4rq-user-environment/lib/libGL.so.1.7.0
/nix/store/5asb6r1c2hxc7wlnriw25sizg4jvv4gi-user-environment/lib/libGL.so.1
/nix/store/5asb6r1c2hxc7wlnriw25sizg4jvv4gi-user-environment/lib/libGL.so
/nix/store/5asb6r1c2hxc7wlnriw25sizg4jvv4gi-user-environment/lib/libGL.so.1.7.0
/nix/store/8d3jb52mhi9rl0842pixzlwx4rq3npy2-libglvnd-1.6.0/lib/libGL.so.1
/nix/store/8d3jb52mhi9rl0842pixzlwx4rq3npy2-libglvnd-1.6.0/lib/libGL.so
/nix/store/8d3jb52mhi9rl0842pixzlwx4rq3npy2-libglvnd-1.6.0/lib/libGL.so.1.7.0
/nix/store/ppwcp29llynp6wzb9mkh693i91a0w74j-libglvnd-1.6.0/lib/libGL.so.1
/nix/store/ppwcp29llynp6wzb9mkh693i91a0w74j-libglvnd-1.6.0/lib/libGL.so
/nix/store/ppwcp29llynp6wzb9mkh693i91a0w74j-libglvnd-1.6.0/lib/libGL.so.1.7.0
/nix/store/vnjrm8a54383r8pmm22awhr69gxxd79z-libglvnd-1.6.0/lib/libGL.so.1
/nix/store/vnjrm8a54383r8pmm22awhr69gxxd79z-libglvnd-1.6.0/lib/libGL.so
/nix/store/vnjrm8a54383r8pmm22awhr69gxxd79z-libglvnd-1.6.0/lib/libGL.so.1.7.0
/nix/store/1k87lf3ar245hg06kw4fynv4vmcj6pzc-libglvnd-1.6.0/lib/libGL.so.1
/nix/store/1k87lf3ar245hg06kw4fynv4vmcj6pzc-libglvnd-1.6.0/lib/libGL.so
/nix/store/1k87lf3ar245hg06kw4fynv4vmcj6pzc-libglvnd-1.6.0/lib/libGL.so.1.7.0
/nix/store/jai888152djsa0496lm5m04lxwkm1vly-libglvnd-1.7.0/lib/libGL.so.1
/nix/store/jai888152djsa0496lm5m04lxwkm1vly-libglvnd-1.7.0/lib/libGL.so
/nix/store/jai888152djsa0496lm5m04lxwkm1vly-libglvnd-1.7.0/lib/libGL.so.1.7.0
/nix/store/2bzq7fmdpd83d606gh6ifbmx34g9yrbm-system-path/lib/libGL.so.1
/nix/store/2bzq7fmdpd83d606gh6ifbmx34g9yrbm-system-path/lib/libGL.so
/nix/store/2bzq7fmdpd83d606gh6ifbmx34g9yrbm-system-path/lib/libGL.so.1.7.0
/nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so.1
/nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so
/nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so.1.7.0
/nix/store/vyn768c7nq7a8hwyzbkiik3ih6d0rpwx-libglvnd-1.7.0/lib/libGL.so.1
/nix/store/vyn768c7nq7a8hwyzbkiik3ih6d0rpwx-libglvnd-1.7.0/lib/libGL.so
/nix/store/vyn768c7nq7a8hwyzbkiik3ih6d0rpwx-libglvnd-1.7.0/lib/libGL.so.1.7.0
/nix/store/3nbvki8kpyni8nq8q6dbzhrmrpgcbvyz-libglvnd-1.6.0/lib/libGL.so.1
/nix/store/3nbvki8kpyni8nq8q6dbzhrmrpgcbvyz-libglvnd-1.6.0/lib/libGL.so
/nix/store/3nbvki8kpyni8nq8q6dbzhrmrpgcbvyz-libglvnd-1.6.0/lib/libGL.so.1.7.0
/nix/store/p203lgdn66r61in95pk9z2gpbadg159f-system-path/lib/libGL.so.1
/nix/store/p203lgdn66r61in95pk9z2gpbadg159f-system-path/lib/libGL.so
/nix/store/p203lgdn66r61in95pk9z2gpbadg159f-system-path/lib/libGL.so.1.7.0
/nix/store/9i4qfl1vl4mcm9l43d52d3sv5bi3nq9z-system-path/lib/libGL.so.1
/nix/store/9i4qfl1vl4mcm9l43d52d3sv5bi3nq9z-system-path/lib/libGL.so
/nix/store/9i4qfl1vl4mcm9l43d52d3sv5bi3nq9z-system-path/lib/libGL.so.1.7.0
/nix/store/nvab3s2py3nb87464l48sibbd921xg1h-system-path/lib/libGL.so.1
/nix/store/nvab3s2py3nb87464l48sibbd921xg1h-system-path/lib/libGL.so
/nix/store/nvab3s2py3nb87464l48sibbd921xg1h-system-path/lib/libGL.so.1.7.0
/nix/store/ddr4jz8pcd9040rsnyz91x5b38k2z6pi-system-path/lib/libGL.so.1
/nix/store/ddr4jz8pcd9040rsnyz91x5b38k2z6pi-system-path/lib/libGL.so
/nix/store/ddr4jz8pcd9040rsnyz91x5b38k2z6pi-system-path/lib/libGL.so.1.7.0
/nix/store/1v7iw4cfb4k6hk7a5mal7ppi3dx0day1-system-path/lib/libGL.so.1
/nix/store/1v7iw4cfb4k6hk7a5mal7ppi3dx0day1-system-path/lib/libGL.so
/nix/store/1v7iw4cfb4k6hk7a5mal7ppi3dx0day1-system-path/lib/libGL.so.1.7.0
/nix/store/fag12n4m3mapvd59s1cjbc2zhr3mpbpg-system-path/lib/libGL.so.1
/nix/store/fag12n4m3mapvd59s1cjbc2zhr3mpbpg-system-path/lib/libGL.so
/nix/store/fag12n4m3mapvd59s1cjbc2zhr3mpbpg-system-path/lib/libGL.so.1.7.0
/nix/store/ri8zm2q14pcv4s1hkmg8gbkgzc16m0lg-system-path/lib/libGL.so.1
/nix/store/ri8zm2q14pcv4s1hkmg8gbkgzc16m0lg-system-path/lib/libGL.so
/nix/store/ri8zm2q14pcv4s1hkmg8gbkgzc16m0lg-system-path/lib/libGL.so.1.7.0

Uh I'm not familiar with such system, I guess I'll have to install it myself and check. I'll try to give an answer in a few days.

Thank you for your effort. If you have anything I could help with, e.g. questions about NixOS, feel free to contact me. I will try my best to help, I use Gitnuro daily and would love to have it up and running correctly again. Sadly I don't think I'm capable of debugging this issue on my own much further, I don't even know where to start. But if you have anything for me to try out I can offer to do that.

I've been looking into it but I'm not familiar enough with the package manager. Do you know if there is some way to add a dependency the script you posted?

AFAIK, nix packages can't access system dependencies as it would happen in other system (correct me if I'm wrong).

If this guide correct, to add dependency you just need to specify libraries with
buildInputs = [lib1 lib2];
in config file
list off packages can be founded here

If this guide correct, to add dependency you just need to specify libraries with buildInputs = [lib1 lib2];

It's true that you can specify dependencies with buildInputs, but nativeBuildInputs also exists, as well as a few more options. I don't quite understand the difference myself, see more here.

list off packages can be founded here

I'm pretty sure the package in question is just libGL, but as mentioned in an earlier comment, I will also try out libGLU and libglibutil just in case.

I will comment again after trying this out.

I tried adding

buildInputs = [ libGL libGLU libglibutil ];
nativeBuildInputs = [ libGL libGLU libglibutil ];

to the build script I posted in an earlier comment (we call them "derivations" in nix-lingo). I also added them to my system packages to install them globally as well.

This sadly does not change anything, I still run into the same problem I opened this issue for.

I've spent a few more hours looking into it but no luck. Seems to be something related to how NixOS handles OpenGL: https://nixos.wiki/wiki/OpenGL

Flatpak includes all that stuff by itself so it's not needed in the host OS.

I don't think I can spend more time in this as it seems to be NixOS specific, I'd try asking for help in the Nix forums (or perhaps other communication tools such as discord or slack).

Alright, thank you for your effort. I guess I will try asking for help in a NixOS forum. I will comment again here if I find a fix.

This PR will fix the issue for the official gitnuro package in nixpkgs. I tried out its changed package definition for Gitnuro, and it works like a charm. Thank you for your effort!