fakechroot and ldconfig
Hello. I try to use fakechroot with my prebuild rootfs like this:
fakechroot
fakeroot
chroot /tmp/chroot/ /bin/sh
But after running any applications which used different from my host system libs I obtain error:
# ping
ping: error while loading shared libraries: libnettle.so.6: cannot open shared object file: No such file or directory
It seems that fakechroot uses ld.so.cache from host systems instead of rootfs.
Has anything method to run application inside rootfs with own environment?
Thank you.
I try to use:
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/fakechroot/libfakechroot.so:/usr/lib/x86_64-linux-gnu/libfakeroot/libfakeroot-sysv.so chroot /tmp/chroot64 /bin/bash
When I try to use linker in chroot64:
export FAKECHROOT_ELFLOADER=/tmp/chroot64/lib/x86_64-linux-gnu/ld-2.28.so
Using library path in chroot:
export FAKECHROOT_LDLIBPATH=/tmp/chroot64/lib:/tmp/chroot64/lib32:/tmp/chroot64/lib64:/tmp/chroot64/libx32:/tmp/chroot64/usr/lib:/tmp/chroot64/usr/lib/x86_64-linux-gnu:/tmp/chroot64/lib/x86_64-linux-gnu
And avoiding host system library path:
export FAKECHROOT_EXCLUDE_PATH=/lib64:/lib:/lib32:/libx32:/usr/lib64:/usr/lib:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu
But after running /bin/bash linker still have used libraries from host system yet:
[pid 1638980] openat(AT_FDCWD, "/tmp/chroot64/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Нет такого файла или каталога)
[pid 1638980] openat(AT_FDCWD, "/tmp/chroot64/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (Нет такого файла или каталога)
[pid 1638980] openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
And also it seems path specified in FAKECHROOT_LDLIBPATH has ignored