qemu and chroot

qemu and chroot

Valery Reznic valery_reznic at yahoo.com
Tue May 20 09:36:32 IDT 2014





>________________________________
> From: Erez D <erez0001 at gmail.com>
>To: linux-il <linux-il at cs.huji.ac.il> 
>Sent: Tuesday, May 20, 2014 9:14 AM
>Subject: qemu and chroot
> 
>
>
>I am using centos 6 and  developing for an armel platform
>
>i created a rootfs using multistrap/debbootstrap
>
>i copied qemu-arm-static to rootfs/usr/bin/qemu-arm-static
>
>and
 i was astonished that doing just 'chroot rootfs' worked, without 
explicitly telling 'chroot' to use qemu-arm-static - somehow it decided 
automatically to run everything under qemu-arm-static without me telling
 it to.
"It" can't decide by itself to run qemu-arm-static.
When you are trying to run executable that no native executable pattern is checked
and if there is registered runners (like qemu, wine, etc) then this runner used.

In order to register runner you have to write magic string into
/proc/sys/fs/binfmt_misc/register

Format of this string described for example here:
http://en.wikipedia.org/wiki/Binfmt_misc

Valery



>
>
>
>after a restart of the server. rootfs does not work anymore automatically,
>
>i get a "chroot: failed to run command `/bin/bash': Exec format error"
>
>doing "chroot rootfs /usr/bin/qemu-arm-static /bin/bash" does chroot, but
>
>i
 get : "bash: /bin/cat: cannot execute binary file" (although 
rootfs/bin/cat is a perfectly ok armel binary, tested on the armel 
target).
>
>i also checked the md5sum of the rootfs/qemu-arm-static binary, and it is ok
>
>
>i
 mounted the rootfs on the armel target using nfs, and chrooted from the
 target, and it works perfectly, meaning there is nothing wrong with the
 rootfs filesystem
>
>
>as it wonderously worked, now it wonerously  doesn't
>
>
>tryed googleling for it , but still cant find how to make it work
>
>
>any idea ?
>
>
>
>_______________________________________________
>Linux-il mailing list
>Linux-il at cs.huji.ac.il
>http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.cs.huji.ac.il/pipermail/linux-il/attachments/20140519/d8204d9f/attachment-0001.html>


More information about the Linux-il mailing list