[Cialug] Binary Not Found?? What??
Todd Walton
tdwalton at gmail.com
Thu Nov 14 14:32:05 UTC 2019
I learned something new the other day. It was amazing, because I had just
read someone's blog post about them running into this very same thing, and
then about a week later I had the issue. It took me a good couple of
minutes before the blog post came back to mind, but when it did: wham! I
knew what was going on. = )
So I started up a container with Alpine Linux running in it, and tried to
run a certain command, which I'll call "mybin" just for convenience's sake.
[todd ~]$ docker run -it --rm alpine /bin/sh
/ # wget <mybin-URL>
/ # ls -l
total 172724
-rwxrwxr-x 1 root root 1203504 Oct 16 2019 mybin
/ # ./mybin
/bin/sh: ./mybin: not found
/ #
Not found?? The thing is right there. I can see it with my own eyes. I can
ls it, I can mv it, it's marked executable, I'm the root user. It can't be
more found than it is! There's no more found it can be! I tried calling it
by fully qualified path as well as relative. What gives?
Oh yeah.... this is what gives:
/ # ldd mybin
/lib64/ld-linux-x86-64.so.2 (0x7f317b362000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7f317b362000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7f317b362000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7f317b362000)
/ # ls -l /lib64/ld-linux-x86-64.so.2
ls: /lib64/ld-linux-x86-64.so.2: No such file or directory
/ # find / -type f -iname '*ld-linux*' -print
/ # echo 'Alpine is musl-based, not glibc.' >/dev/the-viewers-at-home
/ # ldd /bin/ls
/lib/ld-musl-x86_64.so.1 (0x7f6046771000)
libc.musl-x86_64.so.1 => /lib/ld-musl-x86_64.so.1 (0x7f6046771000)
/ # ls -l /lib/ld-musl-x86_64.so.1
-rwxr-xr-x 1 root root 580144 Aug 7 07:15
/lib/ld-musl-x86_64.so.1
Basically, when the shell says "not found" it's because it can't find the
library that binary assumes is available. The way the error is phrased is
just unfortunate.
The blog post that I had remembered is here:
https://jvns.ca/blog/2019/10/28/sqlite-is-really-easy-to-compile/
For what it's worth, I find this musl business to be a pain in the
backside, but, uh, hooray diversity. I guess.
--
Todd
More information about the Cialug
mailing list