Here is an example of what I do: # cd /some/where # cp /bin/bash bin/ # ls -l bin/ # -rwxr-xr-x 1 root root 512540 jan 20 16:41 bash # chroot /some/where # chroot: cannot execute /bin/bash: No such file or directory #whoami root I don't understand, /bin/bash exist and is executable, with FreeBSD I do that without a problem
This is almost certainly a user mistake: Our shell is linked dynamically. Make sure /lib/ld-linux.so.2, /lib/libc.so.6, /lib/libdl.so.2 and /lib/libtermcap.so.2 are in the chroot structure. Without them, bash can't be executed. Alternatively, recompile bash with the "-static" CFLAG. This is what the BSDs do to their shells.