From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vagrant Cascadian Subject: bug#36117: qemu-binfmt with non-native chroot Date: Thu, 06 Jun 2019 10:55:25 -0700 Message-ID: <87r286zjhu.fsf@yucca> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([209.51.188.92]:47919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYwcN-00047K-De for bug-guix@gnu.org; Thu, 06 Jun 2019 13:56:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYwcM-0005vc-6Z for bug-guix@gnu.org; Thu, 06 Jun 2019 13:56:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36992) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hYwcM-0005vU-3m for bug-guix@gnu.org; Thu, 06 Jun 2019 13:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hYwcM-0002kk-0D for bug-guix@gnu.org; Thu, 06 Jun 2019 13:56:02 -0400 Sender: "Debbugs-submit" Resent-Message-ID: Received: from eggs.gnu.org ([209.51.188.92]:47784) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYwc7-0003tO-0X for bug-guix@gnu.org; Thu, 06 Jun 2019 13:55:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hYwc4-0005Yg-Gd for bug-guix@gnu.org; Thu, 06 Jun 2019 13:55:46 -0400 Received: from cascadia.aikidev.net ([2600:3c01:e000:267:0:a171:de7:c]:34872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hYwc3-0005O7-6N for bug-guix@gnu.org; Thu, 06 Jun 2019 13:55:44 -0400 Received: from localhost (unknown [IPv6:2600:3c01:e000:21:21:21:0:100b]) (Authenticated sender: vagrant@cascadia.debian.net) by cascadia.aikidev.net (Postfix) with ESMTPSA id E47A71AC23 for ; Thu, 6 Jun 2019 10:55:29 -0700 (PDT) List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 36117@debbugs.gnu.org --=-=-= Content-Type: text/plain I've been trying to use qemu-binfmt-service-type to build a non-native chroot of a Debian system on Guix... because, well... because! In Debian, this works with the qemu-user-static package, where the binfmt sets these flags: $ cat /proc/sys/fs/binfmt_misc/qemu-aarch64 enabled interpreter /usr/bin/qemu-aarch64-static flags: OCF offset 0 magic 7f454c460201010000000000000000000200b700 mask ffffffffffffff00fffffffffffffffffeffffff In particular, the F flag allows the host system binaries to be used as the interpreter inside the chroot. But apparently, this only works with static-built qemu targets, according to the linux's Documentation/admin-guide/binfmt-misc.rst. On Guix there are no flags set, and the binary used is a dynamically linked executable: $ cat /proc/sys/fs/binfmt_misc/qemu-aarch64 enabled interpreter /gnu/store/sw2rrqmjij73wcy3ajd47ypvmzh12yz6-qemu-3.1.0/bin/qemu-aarch64 flags: offset 0 magic 7f454c460201010000000000000000000200b700 mask ffffffffffffff00fffffffffffffffffeffffff So there are (at least) two things needed to make this work on Guix: * A way to set the flags on qemu-binfmt-service-type. * A static build of qemu-user targets * A way to set which qemu to use for qemu-binfmt-service-type. The *three* things are... With this working correctly foreign-architecture chroots would become trivial: # on an amd64 host: $ debootstrap --arch=arm64 buster buster-chroot http://deb.debian.org/debian ... $ chroot buster-chroot /bin/bash Enabling qemu-binfmt-service-type to operate in this way would obviate the need for the "guix-support?" qemu-binfmt-configuration option, as you could simply assemble the build environment without having to include all of qemu's dependencies in the container. It's a pretty magical feature. live well, vagrant --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEARYKAB0WIQRlgHNhO/zFx+LkXUXcUY/If5cWqgUCXPlTjQAKCRDcUY/If5cW qoyzAPwN0Pfs8K7XDxPZwr5pCsE9J17Y0vwvleFkRkdv6t2fRwD/fXCsT/L6RaTv PaLNLd2mCSM8uXgJXyuXJYU1MmQoNgk= =NkZM -----END PGP SIGNATURE----- --=-=-=--