Issue running / packaging an AppImage

Glad to hear that we’re on the same page :slightly_smiling_face:

Thanks for the clarification, I think I got confused by the similarity of ldd and LD_....

I went ahead and removed the lib directory, but since I couldn’t find the library in Nix packages, I kept only this one from the AppImage content. I’m now left with this in my store:

$ nix shell 'nixpkgs#tree' -c tree -d -L 2
├── bin
├── lib
├── resources
├── share
│   ├── applications
│   ├── icons
│   ├── kDrive_client
│   └── mime
└── translations
    └── qtwebengine_locales

While lib contains only:

-r--r--r-- 1 root root 6,7M  1 janv.  1970

I took a look at the Qt documentation in the Nixpkgs manual and went ahead to wrap kDrive as a Qt application:


kdrive = qt6Packages.callPackage ../applications/misc/kdrive { };


stdenv.mkDerivation rec {
  # ...
  dontWrapQtApps = true;

  buildInputs = [ qtbase ];
  nativeBuildInputs = [ wrapQtAppsHook ];

  # ...

  postFixup = ''
    # patchelf stuff

    wrapQtApp $out/bin/kDrive

Full diff available here

Now, I can see the kDrive desktop entry in Gnome, but I still can’t run it somehow.

When running kDrive I see again the initial error message, alongside a Qt error:

$ kDrive
kDrive server starting
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
kDrive server initialization error: Unable to open parameters database.

I can get rid of the Qt error by following what @Rigor1934 mentioned yesterday: adding QT_QPA_PLATFORM=xcb. But the server initialization error remains.

Looking at the logs, I have this:

2024-02-07 16:05:16:140 [I] (140268897102400) log.cpp:126 - Logger initialization done
2024-02-07 16:05:16:141 [I] (140268897102400) appserver.cpp:2848 - kDrive locale:[en_US] version:[3.5.7master (build 20240124)] os:[NixOS 24.05 (Uakari)]
2024-02-07 16:05:16:141 [I] (140268897102400) appserver.cpp:166 - New DB exists : /home/nicolas/.config/kDrive/.parms.db => 1
2024-02-07 16:05:16:141 [I] (140268897102400) appserver.cpp:167 - Old config exists : /home/nicolas/.config/kDrive/kDrive.cfg => 1
2024-02-07 16:05:16:141 [D] (140268897102400) db.cpp:562 - sqlite3 version=3.44.2
2024-02-07 16:05:16:141 [D] (140268897102400) db.cpp:578 - sqlite3 locking_mode=normal
2024-02-07 16:05:16:141 [D] (140268897102400) db.cpp:595 - sqlite3 journal_mode=wal
2024-02-07 16:05:16:141 [D] (140268897102400) db.cpp:615 - sqlite3 synchronous=NORMAL
2024-02-07 16:05:16:141 [D] (140268897102400) db.cpp:630 - sqlite3 case_sensitivity=ON
2024-02-07 16:05:16:141 [D] (140268897102400) db.cpp:645 - sqlite3 foreign_keys=ON
2024-02-07 16:05:16:141 [D] (140268897102400) db.cpp:348 - Check DB version
2024-02-07 16:05:16:141 [I] (140268897102400) db.cpp:441 - Prepare DB
2024-02-07 16:05:16:142 [W] (140268897102400) parmsdb.cpp:611 - Cannot open exclusion templates file sync-exclude.lst
2024-02-07 16:05:16:142 [W] (140268897102400) parmsdb.cpp:1275 - Error in updateExclusionTemplates
2024-02-07 16:05:16:142 [W] (140268897102400) parmsdb.cpp:1224 - Error in initParameters
2024-02-07 16:05:16:142 [W] (140268897102400) db.cpp:443 - Error in Db::prepare
2024-02-07 16:05:16:142 [E] (140268897102400) db.cpp:649 - Database initialisation error
2024-02-07 16:05:16:142 [D] (140268897102400) db.cpp:241 - Closing DB /home/nicolas/.config/kDrive/.parms.db
2024-02-07 16:05:16:142 [D] (140268897102400) db.cpp:472 - No database Transaction to commit

At first, I thought it was a permissions issue with the sync-exclude.lst file, so I tried to use install instead of cp to set its permissions to rw-rw-rw- but it doesn’t work (and I think this is normal since the Nix store is and should remain read-only):

installPhase = ''
  runHook preInstall

  for dir in resources translations; do
    mkdir -p $out/$dir
    cp -R ${contents}/usr/$dir/* $out/$dir
  mkdir -p $out/bin
  install -m 0555 ${contents}/usr/bin/kDrive $out/bin
  install -m 0555 ${contents}/usr/bin/kDrive_client $out/bin
  install -m 0444 ${contents}/usr/bin/qt.conf $out/bin
  install -m 0666 ${contents}/usr/bin/sync-exclude.lst $out/bin
  ls -lah $out/bin
  for dir in applications icons kDrive_client mime; do
    mkdir -p $out/share/$dir
    cp -R ${contents}/usr/share/$dir/* $out/share/$dir
  mkdir -p $out/lib
  cp -R ${contents}/usr/lib/ $out/lib

  runHook postInstall

Here is the bin directory listing:

$ ls -lah bin
total 26M
dr-xr-xr-x 2 root root 4,0K  1 janv.  1970 .
dr-xr-xr-x 7 root root 4,0K  1 janv.  1970 ..
-r-xr-xr-x 1 root root  16K  1 janv.  1970 kDrive
-r-xr-xr-x 1 root root  12M  1 janv.  1970 kDrive_client
-r-xr-xr-x 1 root root  15M  1 janv.  1970 .kDrive-wrapped
-r--r--r-- 1 root root  108  1 janv.  1970 qt.conf
-r--r--r-- 1 root root  315  1 janv.  1970 sync-exclude.lst

No symbolic links, nothing. The sync-exclude.lst file is read-only and I suspect this to be the issue.

I’m wondering if I could place the file somewhere else where it would be writable and create a symlink in the store location. I’ll try to do that later and keep you posted.

Thanks again for your help, let me know if you have any more of your good ideas/pointers :smile:

EDIT: I found a weird thing!

If I cd in kDrive location in the Nix store, and run kDrive from the bin directory, it works! That’s so frustrating, I feel that I’m very close to make it work but I don’t fraking understand why it tries to load the file relatively from the PWD

Ok, I can now launch the application from its desktop entry and see the graphical interface.

However, the application is really slow, and I can’t see the checkboxes in the preferences window for example. I’ll have to dig deeper, but that’s a huge step!

I wouldn’t have been able to go this far without your help @Cloudef :partying_face:


I have been able to compare the behavior from an Ubuntu VM. I can confirm that the application is working since I managed to connect to my account and synchronize some folders.

However, I found several things which are not working:

  • some graphical elements (like toggles, icons or checkboxes) are not showing at all
  • the Gnome integration is not working
  • after login, the application is just black so I cannot use it as-is

There are no errors showing in the logs, and I can’t find a way to debug the graphical part of the application.


I suspect that the missing graphical elements are related to the QT_QPA_PLATFORMTHEME variable but whatever I try (gtk2, gtk3, qtc5) the application is always missing some elements.

As for the Gnome integration, I didn’t find anything related to Gnome in the files. I didn’t search anything related to that, yet. It just works OOTB in Ubuntu.

Regarding the application slowness, it’s not the whole app, only the web views are slow (really really slow). All inputs are taken right away, but the visual feedback is lagging far behind.
Example: I click on the email input, then type in my email, hit tab to switch to the password input, type in my password and I have to wait for ~30s before seeing the fields filled with my inputs.

It could be the app uses some custom Qt plugins that it needs for full functionality, so the files bundled in the AppImage might’ve been there for a reason. The app might not read from $out/share/icons which would explain missing icons. Strace is your friend again.

Bit unrelated, but I made progress with my Flatpak by copying the sync-exclude.lst to the root of the appimage folder. I now manage to start kDrive but I get this error:

user@fedora:~/flatpak$ flatpak run com.infomaniak.kdrive
kDrive server starting

(process:3): GLib-GObject-CRITICAL **: 13:23:13.440: type_add_flags_W: assertion '(flags & ~TYPE_FLAG_MASK) == 0' failed
/app/kdrive/usr/lib/ version `GNUTLS_3_7_4' not found (required by /usr/lib/x86_64-linux-gnu/gio/modules/
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/

(process:3): GLib-GObject-CRITICAL **: 13:23:13.440: type_add_flags_W: assertion '(flags & ~TYPE_FLAG_MASK) == 0' failed

and the kDrive window just shows a message “This site can’t be reached” “ERR_CERT_AUTHORITY_INVALID” (I think it’s uses QtWebEngine or another webview implementation to get to the login page).

Any ideas how to fix it?

Ok, I made it (mostly) fully work by using the whole original lib and plugins directories.

I tried getting rid of the lib directory but ended up having to keep the following libs so neither ldd nor qt complains about missing libraries:


But then the application wouldn’t launch its graphical interface. So I reverted my changes and stuck with the original lib and plugins directories. Everything (aside from the Gnome tray icon) was working fine, so I decided to retry the whole setup from the beginning: I logged out of my account to retry the login process.

Sadly, there are still very poor performances on the signin window (which is IMO a simple webview so I don’t quite understand)… But for now I guess it’s pretty good since I can use the app without any bugs nor performance issues when I’m logged in my account. And the two-way sync works perfectly.

I’ll try to make the Gnome tray icon work because once I close the UI I can’t relaunch it since it’s running in background and complaining that « kDrive application is already running ».

@Rigor1934 I don’t know anything about flatpak, are you trying to write a Nix derivation for flatpak?

Did you try ldd to see what are the missing libs required by your binary?

If you want to see what I have done so far, you can look at this file in my nixpkgs repository.

I managed to make the tray icon work by adding this Gnome extension.

Now all that remains is to find why the webview is so slow… But I’m kinda stuck on this :frowning_face:

No, nothing to do with Nix, I’m just reading here because you are the only person who ever tried to repackage kDrive :smiley:

My Flatpak starts but I get the error “ERR_CERT_AUTHORITY_INVALID” in the QtWebEngine login page. I was just wondering if you had a similar problem at any point or if this is purely a Flatpak issue.

Not sure I could be of any help on this matter I’m afraid :confused:

Did you add p11-kit to your dependencies?