Subject: Re: Problem using chroot...
To: None <netbsd-help@netbsd.org>
From: Frank Goodman <krampus@gmail.com>
List: netbsd-help
Date: 08/18/2005 13:56:32
Ahh.. forgot the shared library loaders, been working too much with
linux lately, where this step isn't needed ->

bash# cp /usr/libexec/ld.elf_so /jail/usr/libexec/
bash# cp /usr/libexec/ld.so /jail/usr/libexec/
bash# chroot /jail /bin/csh
# bash
bash#

Tah-dah ...

-krpmz

On 8/18/05, Frank Goodman <krampus@gmail.com> wrote:
> Hi,
>=20
> 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 ->
>=20
> <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>
>=20
> I get this error for every binary that's dynamically linked... can
> anyone tell me what I'm doing wrong?
>=20
> Thanks,
> -krmpz
>