Subject: Problem using chroot...
To: None <netbsd-help@netbsd.org>
From: Frank Goodman <krampus@gmail.com>
List: netbsd-help
Date: 08/18/2005 13:48:11
Hi,

I'm having a big problem with the chroot command. Namely,
dynamically-linked binaries refuse to work, even when the libraries
they use are copied (I believe) appropriately. Here's an example ->

<snip>
bash# rm -rf jail
bash# mkdir jail
bash# rmdir jail
bash# mkdir -p jail/bin
bash# mkdir -p jail/usr/lib
bash# cp /bin/bash jail/bin
bash# cp /bin/csh jail/bin
bash# cp /bin/ls jail/bin/
bash# ldd `which bash`
/bin/bash:
         -ltermcap.0 =3D> /usr/lib/libtermcap.so.0
         -lc.12 =3D> /usr/lib/libc.so.12
bash# cp /usr/lib/libtermcap.so.0 jail/usr/lib/
bash# cp /usr/lib/libc.so.12 jail/usr/lib/
bash# chroot /jail /bin/csh
# ls
bin usr
# bin/bash
bin/bash: Exec format error. Wrong Architecture.
</snip>

I get this error for every binary that's dynamically linked... can
anyone tell me what I'm doing wrong?

Thanks,
-krmpz