I have a Linux kernel and I chroot it on /var/chroot
:
I added bash
dependencies like so:
ldd /bin/bash linux-vdso.so.1 => (0x00007fff9a373000) libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f24d57af000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f24d55ab000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f24d51eb000) /lib64/ld-linux-x86-64.so.2 (0x00007f24d59f8000)
Then I did:
# cd /var/chroot/ # mkdir bin/ lib64/ lib/ # cp /lib/x86_64-linux-gnu/libtinfo.so.5 lib/ # cp /lib/x86_64-linux-gnu/libdl.so.2 lib/ # cp /lib/x86_64-linux-gnu/libc.so.6 lib/ # cp /lib64/ld-linux-x86-64.so.2 lib64/ # cp /bin/bash bin/
after that:
# chroot /var/chroot
After that I copied /bin/ls
and the libraries shown by ldd ls
. But when I run ls
I have the following error:
ls: error while loading shared libraries: libpthread.so.0: wrong ELF class: ELFCLASS32
ldd
output of the chrooted executable instead, since it's the one which is causing trouble... Besides, there doesn't seem to be any "no such file in directory" error involved.