linux - Is libc.so.2 required to be located in /usr/lib? -
linux - Is libc.so.2 required to be located in /usr/lib? -
i have directory next contents:
bin/busybox lib/ld-linux.so.2 lib/libc.so.6
and when invoke:
chroot . bin/busybox sh
it fails following:
/bin/busybox: error while loading shared libraries: libc.so.6: cannot open shared object file: no such file or directory
when move lib/libc.so.6 usr/lib, works fine.
why libc required in /usr/lib? when invoke:
objcdump -p bin/busybox | grep needed
i get:
needed libc.so.6
so thought, soname of library used without slashes etc. loaded able find in standard folders, /lib , /usr/lib. apparently, not case.
to create matters more confusing, ld-linux.so.2 seems have in /lib because when moved /usr/lib, chroot fails with:
chroot: failed run command '/bin/busybox': no such file or directory
which learned error loader cannot found, not busybox binary.
is issue libc.so.2 distro specific? if important, i'm using arch linux.
the location of loader (typically /lib/ld-linux.so
) hard-coded in binary. there's no search process component — if cannot found, binary won't run @ all.
(the exact path depends on libc , architecture you're using. it's @ /lib64/ld-linux-x86-64.so.2
glibc on x86_64, instance.)
the locations searched dynamic libraries configurable in /etc/ld.so.conf
. if don't have file in chroot, though, of standard paths may not configured!
linux archlinux libc chroot
Comments
Post a Comment