On Tue, May 20, 2014 at 12:13 PM, Erez D <erez0...@gmail.com> wrote:
> ok, it now works
> /proc/sys/fs/binfmt_misc/qemu-arm was missing,
> internet searc told me to look for 'binfmt-support' pkg, however i
> could not find none for centos6
> so as chrooted systems share the same kernel (just need to mount /proc
> under the chroot dir), I chroot to my wheezy_i686 (i have some chroots
> for testing other disros), and there i did apt-get install
> binfmt-support qemu-user-static, and update-binfmts --display
>
> now i have /proc/sys/fs/binfmt_misc/qemu-arm. amd everything works again
>
>
> (i do not know if this is permenent or will require redoing after
> reboot), but i will check it at next reboot (somthing like in 6 months
> ;-)

it seems that it not permamenent.
my chroot has a /etc/init.d/binfmt-support script which makes it permanent,
however i do not boot the chroot system ;-)
so i added the following line to rc.local :
chroot /home/chroot/wheezy_i686/  /etc/init.d/binfmt-support start

now it is permenent
(i wish centos had this package so i wouldn't have to deal with such hacks).

>
> thanks
> erez
>
> On Tue, May 20, 2014 at 11:22 AM, Tzafrir Cohen <tzaf...@cohens.org.il> wrote:
>> On Tue, May 20, 2014 at 09:14:16AM +0300, Erez D wrote:
>>> 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
>>
>> There's something missing from your description. I suspect you forgot to
>> mention it: debootstrap's run can be broken to two parts: one that
>> downloads everything, and the second stage that needs to run inside the
>> chroot. In that case:
>>
>>   debootstrap --foreign [--arch=] [rest of parameters]
>>   chroot to/chroot
>>   ./debootstrap --second-stage
>>
>> At least in Debian, the package qemu-user-static includes the wrapper
>> qemu-debootstrap to do just that, and also copy the required
>> qemu-user-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.
>>>
>>>
>>> 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
>>
>> A chroot does not replace the kernel. It's running on your kernel and
>> that kernel does not natively support the armel binaries.
>>
>> In Debian, the package qemu-user-static registers foreign Linux ELF
>> formats. So maybe you forgot this is needed. Specifically:
>>
>> $ cat /proc/sys/fs/binfmt_misc/qemu-arm
>> enabled
>> interpreter /usr/bin/qemu-arm-static
>> flags:
>> offset 0
>> magic 7f454c4601010100000000000000000002002800
>> mask ffffffffffffff00fffffffffffffffffeffffff
>>
>> --
>> Tzafrir Cohen         | tzaf...@jabber.org | VIM is
>> http://tzafrir.org.il |                    | a Mutt's
>> tzaf...@cohens.org.il |                    |  best
>> tzaf...@debian.org    |                    | friend
>>
>> _______________________________________________
>> Linux-il mailing list
>> Linux-il@cs.huji.ac.il
>> http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

_______________________________________________
Linux-il mailing list
Linux-il@cs.huji.ac.il
http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il

Reply via email to