[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Problems with creating a 32-bit chroot jail (chroot exec format error)

Paul Patrick Carpio Prantilla wrote:

I've been stuck at this for some time now. From my x86_64 kernel, I'm
trying to install a 32-bit chroot jail under /var/chroot/sid-ia32/. I've
 already used debootsrap to create a 32-bit sid environment under for
that directory, and basically followed the guidelines to the letter from
the following urls:


However, I can never get very far because chroot always fails with this

root@terrabreak:~# chroot /var/chroot/sid-ia32/
chroot: cannot run command `/bin/bash': Exec format error

I take this to mean that the current 64-bit kernel/environment can't
execute the bash binary under the 32-bit environment. I've straced the
command and it does indeed show that the bash binary under the chroot
can't be executed:

chroot("/var/chroot/sid-ia32/")         = 0         <---seems ok here
chdir("/")                              = 0         <---ditto
execve("/bin/bash", ["/bin/bash", "-i"], [/* 15 vars */]) = -1 ENOEXEC
(Exec format error)
execve("/bin/sh", ["/bin/sh", "/bin/bash", "-i"], [/* 15 vars */]) = -1
ENOEXEC (Exec format error)

Running ldd on the 32-bit bash binary shows the following:

root@terrabreak:~# ldd /var/chroot/sid-ia32/bin/bash
/usr/bin/ldd: line 161: /lib/ld-linux.so.2: cannot execute binary file
/usr/bin/ldd: line 171: /lib/ld-linux.so.2: cannot execute binary file
ldd: /lib/ld-linux.so.2 exited with unknown exit code (126)

I'm not sure why this keeps on happening even if I've updated my 32-bit
linker at /lib/ld-linux.so.2 to point at the right linker from the
debootstrap installation. I also tried installing the ia32-libs package
(which also updates the /lib/ld-linux.so.2 symlink) and related 32-bit
gcc and libc packages, but the same error shows.

I made sure to run ldconfig each time I changed my ld.so.conf file. I've
also bind mounted /home  /tmp and proc under the debootstrap environment
just like the urls above suggests.

Lastly, my ld.so.conf file is as follows:


#These two are included from /etc/ld.so.conf.d

# chroot i386 system libs

I'd greatly appreciate any pointer or clue as to how I can resolve this
chroot error. Though I spent some time googling for help, I'd like to
apologize in advance if I am missing something very very obvious.


Where did your kernel come from?

Reply to: