Dolphin can't find `execvp`, and Bash can't find the script I ask it to execute

I’d like to use the Lumatone Editor. It’s written for Linux, but not NixOS. I’d like to write a NixOS installer for it. I imagine I’ll have to first know how to run it at all, and I haven’t figured out how to do that.

Its procedural installer, which I successfully ran, just copies a few innocuous files to some non-privileged folders, without using sudo. After that, I’m supposed to be able to run it by clicking on the binary called Lumatone Editor.

When I do that, from Dolphin, I get the error

execvp: No such file or directory

When I instead try to run the executable from the command line, Bash claims not to be able to find it – right after telling me that it’s a 29 MB executable and not a symlink:

jeff@jbb-hp17:Lumatone-Editor-1.0.2$ du -hs Lumatone\ Editor
29M     Lumatone Editor
jeff@jbb-hp17:Lumatone-Editor-1.0.2$ ls -l Lumatone\ Editor
-rwxr-xr-x 1 jeff users 30077624 Apr 17 13:01 'Lumatone Editor'
jeff@jbb-hp17:Lumatone-Editor-1.0.2$ ./Lumatone\ Editor
-bash: ./Lumatone Editor: No such file or directory

Binaries not made for nixos generally won’t run on it, due to the filesystem structure. Specifically, the dynamic linker isn’t in the standard location for other distros, but in the nix store instead. That’s the cause of the No such file or directory error. It can’t find the linker, and thus can’t run the executable. The situation is analogous to a script that starts with #! /bin/bash. There is no /bin/bash on nixos, so attempting to run such a script will fail with a No such file or directory error.

There are a few solutions to this:

  • For a quick temporary fix, you can try running the executable with steam-run. This makes a container much more like a normal linux distro and runs the executable in that.
  • For a more permanent fix, you usually want to write your own derivation, for which there are 3 main strategies:
    • Build from source, if you can. This is the ideal solution.
    • Use autoPatchelfHook to alter the ELF metadata to point toward the linker and dynamic libraries in the nix store.
    • Build a container similar to steam-run’s but tailored to your program with buildFHSUserEnv
2 Likes

Thanks, @tejing, for the fantastic response.

I’ve asked Lumatone to share the source. Will try steam-run in the meantime.

I’m haven’t figured out how to use steam-run. I tried the obvious thing, and got a complaint that libssh2 wasn’t available:

jeff@jbb-hp17:Lumatone-Editor-1.0.2$ steam-run ./Lumatone\ Editor
./Lumatone Editor: error while loading shared libraries: libssh2.so.1: cannot open shared object file: No such file or directory

So I made some wild guesses about dependencies (too many can’t hurt, right?), and wrote this shell.nix:

{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSUserEnv {
  name = "steam-lumatone";
  targetPkgs = pkgs: (with pkgs; [
    steam-run
    libssh2
    glibc
    python310
  ]);
  runScript = "bash";
}).env

Running nix-shell didn’t work initially, but the error messages regarding unfree software explained how I could do the following, after which it did:

jeff@jbb-hp17:Lumatone-Editor-1.0.2$ export NIXPKGS_ALLOW_UNFREE=1            
jeff@jbb-hp17:Lumatone-Editor-1.0.2$ nix-shell --impure
these 7 derivations will be built:                                      
... <magic happens> ..
created 1035 symlinks in user environment
building '/nix/store/mw13k6vzj7agyjwwlh2nvk5qf4kqglf5-steam-lumatone-fhs.drv'...
building '/nix/store/9znybmf57sch92csdv3yrrsy3csy1344-steam-lumatone-init.drv'...

But even in that Nix shell I still get the same error about libssh2:

steam-lumatone-chrootenv:jeff@jbb-hp17:~/non-nix-apps/Lumatone-Editor-1.0.2$ steam-run ./Lumatone\ Editor
./Lumatone Editor: error while loading shared libraries: libssh2.so.1: cannot open shared object file: No such file or directory

buildFHSUserEnv and steam-run are mutually exclusive. You can’t combine them. The steam-run invocation blew away the external environment to make its own container.