How to solve "The file '<executable>' does not exist or could not be executed."

Hello,

Sometimes when I try to execute an executable that is not installed by nix, I receive the error:

Failed to execute process '<executable>'. Reason:
The file '<executable>' does not exist or could not be executed.

Unfortunately there is no further information why the executable doesn’t work.

E.g. I got this error now in a node context (installed dependencies by npm):

Failed to execute process '/home/philm/.cache/ms-playwright/chromium-775089/chrome-linux/chrome'. Reason:
The file '/home/philm/.cache/ms-playwright/chromium-775089/chrome-linux/chrome' does not exist or could not be executed.

Is there any way to solve this (e.g. with nix-shell)?
A general solution without nix-shell would be preferred though, as especially in non-pure development context this can get quite tedious. (probably a missing package that is required systemwide?).

2 Likes

Either use an FHA environment in a shell, or try steam-run and it’s friends which basically create a temporary FHS environment.

Alternatively patch the executables interpreter with patchelf, might be tedious or even impossible if the app you have starts them from ephemeral storage and redownload/untars it on every run.

2 Likes

What does FHA or FHS environment mean?

Thanks, I also just found out that it might be a problem with the dynamically linked libraries as discussed in this blog post: https://cdagostino.io/posts/2017-07-28-learning-to-love-nix.html#using-it-the-wrong-way

And indeed chrome has the same issue:

$ file /home/philm/.cache/ms-playwright/chromium-775089/chrome-linux/chrome

/home/philm/.cache/ms-playwright/chromium-775089/chrome-linux/chrome: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, not stripped

I just tried steam-run, and it solves this particular problem (although I got a new problem with refused ws connections, but this is a different story).

1 Like

FHA was a typo it is meant to be read as FHS, which is (Linux) File Hirarchy System.

And in this case, it is the interpreter, /lib64/ld-linux-x86-64.so.2 doesn’t exist on nixOS. The interpreter for nixOS is somewhere in the store.

2 Likes

I wrote a list of methods to solve this issue, see here : Different methods to run a non-nixos executable on Nixos - Unix & Linux Stack Exchange

5 Likes

Wow, that’s an extensive list, thanks,

I currently have solved my problem via a docker container btw. (as a Dockerfile was served by playwright).