ldso: "can't load library" due to not using (f)stat64 calls

Bernhard Reutner-Fischer rep.dot.nop at gmail.com
Wed Jan 22 21:09:17 UTC 2014


On 16 January 2014 17:27, Jody Bruchon <jody at jodybruchon.com> wrote:
> I have built a uClibc i386 + BusyBox chroot environment that I previously
> confirmed as working; specifically, if I "chroot . /bin/sh" while in the
> root of it, I would get a BusyBox ash prompt. However, I think something
> changed about Linux or my filesystem that broke my ability to chroot into
> it. My uClibc x86_64 chroot still works fine. My eglibc-2.18 i386 + BusyBox
> chroot also still works fine, leading me to believe the problem is
> uClibc-i386 specific, and probably in the dynamic linker/loader.
>
> I am using uClibc snapshot 2014-01-03 and have an XFS filesystem on a
> Linux-3.12.6 x86_64 system. When I attempt to chroot, I receive the error:
> /bin/sh: can't load library 'libcrypt.so.0' (even though the library is in
> place and was previously working.)
>
> I produced an strace output, noticed the EOVERFLOW errors and the *stat
> family calls not being the 64-bit variants, and since I have had this
> problem with a lot of software recently, having to add
> -D_FILE_OFFSET_BITS=64 to CFLAGS, I assume this is why EOVERFLOW is
> happening and causing a failure.

Well, did you build uClibc with LFS on or off?
If you are using something like xfs you generally want largefile
support and thus
UCLIBC_HAS_LFS=y i suppose :)

please double-check, rebuild if in doubt and let us know.
thanks,
>
> Relevant portion of strace output:
> # strace chroot . /bin/sh
> execve("/usr/bin/chroot", ["chroot", ".", "/bin/sh"], [/* 23 vars */]) = 0
> ---  snip  ---
> arch_prctl(ARCH_SET_FS, 0x7fc8ae28d700) = 0
> mprotect(0x7fc8ae06f000, 16384, PROT_READ) = 0
> mprotect(0x7fc8ae29a000, 4096, PROT_READ) = 0
> munmap(0x7fc8ae28f000, 39592)           = 0
> chroot(".")                             = 0
> chdir("/")                              = 0
> execve("/bin/sh", ["/bin/sh"], [/* 23 vars */]) = 0
> [ Process PID=2787 runs in 32 bit mode. ]
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|0x4000000,
> -1, 0) = 0xf77bf000
> stat("/etc/ld.so.cache", 0xfffffffffff98dac) = -1 EOVERFLOW (Value too large
> for defined data type)
> stat("/etc/ld.so.preload", 0xfffffffffff98e34) = -1 ENOENT (No such file or
> directory)
> open("/lib/libcrypt.so.0", O_RDONLY)    = 3
> fstat(3, 0xfffffffffff98464)            = -1 EOVERFLOW (Value too large for
> defined data type)
> close(3)                                = 0
> open("/lib/libcrypt.so.0", O_RDONLY)    = 3
> fstat(3, 0xfffffffffff98458)            = -1 EOVERFLOW (Value too large for
> defined data type)
> close(3)                                = 0
> open("/usr/lib/libcrypt.so.0", O_RDONLY) = -1 ENOENT (No such file or
> directory)
> mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
> 0xf77be000
> write(2, "", 0)                         = 0
> write(2, "/bin/sh", 7/bin/sh)                  = 7
> write(2, ": can't load library '", 22: can't load library ')  = 22
> write(2, "libcrypt.so.0", 13libcrypt.so.0)           = 13
> write(2, "'\n", 2'
> )                      = 2
> munmap(0xfffffffff77be000, 4096)        = 0
> _exit(16)                               = ?
> +++ exited with 16 +++
>
> Any ideas?
>
> -Jody Lee Bruchon
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://lists.busybox.net/mailman/listinfo/uclibc


More information about the uClibc mailing list