unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Vagrant Cascadian <vagrant@debian.org>
To: 36117@debbugs.gnu.org
Subject: bug#36117: qemu-binfmt with non-native chroot
Date: Thu, 06 Jun 2019 10:55:25 -0700	[thread overview]
Message-ID: <87r286zjhu.fsf@yucca> (raw)

[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

             reply	other threads:[~2019-06-06 17:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-06 17:55 Vagrant Cascadian [this message]
2019-06-07 13:00 ` bug#36117: qemu-binfmt with non-native chroot Ludovic Courtès
2019-06-08  6:03   ` Vagrant Cascadian
2019-06-24 12:25     ` Ludovic Courtès
2021-02-22 19:50       ` bug#36117: [PATCH 1/4] gnu: qemu: Fix indentation and remove trailing #t Maxim Cournoyer
2021-02-22 19:50         ` bug#36117: [PATCH 2/4] gnu: Add glib-static Maxim Cournoyer
2021-02-22 19:50         ` bug#36117: [PATCH 3/4] gnu: qemu: Add a static output Maxim Cournoyer
2021-02-23  8:38           ` Ludovic Courtès
2021-02-25 13:57             ` Maxim Cournoyer
2021-02-25 14:50               ` Ludovic Courtès
2021-02-22 19:50         ` bug#36117: [PATCH 4/4] services/qemu-binfmt: Use the F flag and the static output of QEMU Maxim Cournoyer
2021-02-23  8:37           ` Ludovic Courtès
2021-02-25 21:47             ` Maxim Cournoyer
2021-03-15 22:07               ` bug#36117: qemu-binfmt with non-native chroot Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r286zjhu.fsf@yucca \
    --to=vagrant@debian.org \
    --cc=36117@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).