How to link linux-vdso?

Hello I am trying to run the supabase cli. First installing it through npm pnpm i -g supabase

When trying to run it with

$ supabase

I get the following error

/home/alexander/.local/share/pnpm/supabase: line 13: /home/alexander/.local/share/pnpm/global/5/node_modules/supabase/bin/supabase: No such file or directory

However I can run it with steam-run and that has worked fine, but I would like it to work wothout steam-run.

After running ldd ~/.local/share/pnpm/global/5/node_modules/supabase/bin/supabase
I get the following output:

	linux-vdso.so.1 (0x00007ffcdfcbf000)
	libpthread.so.0 => /nix/store/lxpdbaazqd2s79jx6lngr8nak2rjdaq1-glibc-2.34-210/lib/libpthread.so.0 (0x00007f4e88d1a000)
	libc.so.6 => /nix/store/lxpdbaazqd2s79jx6lngr8nak2rjdaq1-glibc-2.34-210/lib/libc.so.6 (0x00007f4e88b1c000)
	/lib64/ld-linux-x86-64.so.2 => /nix/store/lxpdbaazqd2s79jx6lngr8nak2rjdaq1-glibc-2.34-210/lib64/ld-linux-x86-64.so.2 (0x00007f4e88d21000)

It seems linux-vdso.so.1 is not linked. How can I fix this?

You don’t, the linux-vdso is automatically linked in by the kernel, neither you nor nix needs to do anything for this to work.

I suggest checking the shebang of bin/supabase and/or use LD_DEBUG

See for example this blog post for what is the vDSO and how it works.

The problem is not vDSO though.

No such file or directory relates to the runtime dynamic linker, or you can say dynamic ELF interpreter. Most GNU/Linux distros have an executable like /lib/ld-linux-x86-64.so.2 that helps load the dependencies (like libc.so.6) of a binary. On NixOS, however, different binaries can have different versions of runtime dynamic linker, and all the versions live in /nix/store/. The linker is stored in the executable as an absolute path, so downloaded binaries have a problem here.

You can probably run /nix/store/lxpdbaazqd2s79jx6lngr8nak2rjdaq1-glibc-2.34-210/lib64/ld-linux-x86-64.so.2 supabase and see it work.

Nixpkgs packages that download externally built libraries use patchelf to specify a new path for the dynamic interpreter, as well as the search paths for dynamic libraries. Note that you can also use buildFHSEnv to construct a working environment for supabase but without Steam.

1 Like

Thanks, that makes sense.

I tried running the following as this was in my nix store.

$ /nix/store/psklxdgmw8w02w3lciimb1y43r9yay9m-glibc-2.35-163/lib/ld-linux.so.2 supabase
supabase: error while loading shared libraries: supabase: cannot open shared object file: No such file or directory

But as you can see it did not work.

I am also not sure how I can use buildFHSEnv.

Is there a way I can make just running supabase work? Like making a nix shell?

And follow up question: why does NixOS not provide a fallback runtime dynamic linker? Or is there an option to enable that?

$ /nix/store/psklxdgmw8w02w3lciimb1y43r9yay9m-glibc-2.35-163/lib/ld-linux.so.2 supabase
supabase: error while loading shared libraries: supabase: cannot open shared object file: No such file or directory

But as you can see it did not work.

Maybe NPM does something special…

I am also not sure how I can use buildFHSEnv.

Is there a way I can make just running supabase work? Like making a nix shell?

And follow up question: why does NixOS not provide a fallback runtime dynamic linker? Or is there an option to enable that?

Well, once there are multiple glibc’s installed, the question is «which»

GitHub - Mic92/nix-ld: Run unpatched dynamic binaries on NixOS might help (should be available in NixOS)