I just tried to play around with chroot command only for testing purposes, in order to create a temporary root jail, but I didn't managed to. The platform is CentOS 6.4. and I have done it numerous times so far except for now. I followed the procedure in that order:
- Copy all libraries in above mentioned
chroot /path/to/the/jailand the following appeared:
chroot: failed to run command `/bin/bash': No such file or directory
I am not able to establish where this error comes from and also I have never had such a problem. The same procedure works just fine in Ubuntu server. The problem occurs only on this particular server.
Per comments below, here is some output from debugging commands:
[root@localhost chroot]# find -printf '%M %p\n' drwxr-xr-x . drwxr-xr-x ./bin -rwxr-xr-x ./bin/bash drwxr-xr-x ./var drwxr-xr-x ./var/var drwxr-xr-x ./home drwxr-xr-x ./lib -rwxr-xr-x ./lib/libdl.so.2 -rwxr-xr-x ./lib/libc.so.6 -rwxr-xr-x ./lib/libtinfo.so.5 -rwxr-xr-x ./lib/ld-linux-x86-64.so.2 drwxr-xr-x ./etc
[root@localhost bin]# ldd /mnt/proba1/chroot/bin/bash linux-vdso.so.1 => (0x00007fff6fe00000) libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f12cdd40000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f12cdb38000) libc.so.6 => /lib64/libc.so.6 (0x00007f12cd7a0000) /lib64/ld-linux-x86-64.so.2 (0x00007f12cdf70000)