Statically linked binary recognized as dynamically linked

This is a bit of an oddball and I am wondering if someone encountered this:

I have a statically linked binary: https://github.com/project-zot/zot/releases/download/v2.1.13/zot-linux-amd64

I make it executable via chmod +x and try to run it via ./zot.

Unfortunately I am greeted with:

Could not start dynamically linked executable: ./bin/zot
NixOS cannot run dynamically linked executables intended for generic
linux environments out of the box. For more information, see:
https://nix.dev/permalink/stub-ld

I am surprised as this is a statically linked go executable, double checking with ldd and patchelf reveals:

ldd ./zot
	statically linked
patchelf --print-needed ./zot
# (no output)

Any idea why I am unable to run the executable as is?

It’s not statically linked as far as I see.

$ file ./zot-linux-amd64
./zot-linux-amd64: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a50843f066a0cb4f61262d0f59e6b82795c0579d, stripped

$ strace ./zot-linux-amd64
execve("./zot-linux-amd64", ["./zot-linux-amd64"], 0x7ffde3945a20 /* 77 vars */) = -1 ENOENT (No such file or directory)
strace: exec: No such file or directory
+++ exited with 1 +++

/lib64/ld-linux-x86-64.so.2 is the glibc loader, so I imagine this is dynamically linked against glibc.

1 Like

Argh, thanks so much @waffle8946 . Not sure how I missed that… Now I feel stupid…

Getting the same output as you with file and strace.