On Sunday 04 January 2009 06:41:31 Zhang Weiwu wrote:
> Hello. Sorry for stupid newbie question:
>
> # cp /bin/sh /usr/local/bin/sh
> # chroot /usr/local /bin/sh
> chroot: cannot run command `/bin/sh': No such file or directory
>
> In theory it should work, right? This is the first time I run chroot not
> for rescuing a broken system (which means /dev/ and /proc/ are not
> mounted in chroot jail). However I guess /dev/ and /proc/ doesn't have
> to be mounted to run chroot.
>
> I am sure this is not because the executable is dynamically linked to a
> file outside of the chroot jail, because I also tried to run executables
> compiled with USE=static
>
> What could be the reason (for complaining an existing file "No such file")?
>
> Thanks in advance. Using coreutils-6.10-r2 on ibook/ppc

Do this:

a...@nazgul ~ $ ls -al /bin/sh
lrwxrwxrwx 1 root root 4 Nov 24 09:58 /bin/sh -> bash

sh is a symlink to bash. You do not have bash inside your chroot, and that is 
the file that is not being found. You must also run ldd on bash, see all the 
libs it links to and copy those as well into the chroot

-- 
alan dot mckinnon at gmail dot com

Reply via email to