From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id EMAlAIgEp1+3SwAA0tVLHw (envelope-from ) for ; Sat, 07 Nov 2020 20:33:12 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 4HJ1N4cEp18sLQAAbx9fmQ (envelope-from ) for ; Sat, 07 Nov 2020 20:33:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 624D29401CD for ; Sat, 7 Nov 2020 20:33:11 +0000 (UTC) Received: from localhost ([::1]:52582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kbUta-0001EP-B9 for larch@yhetil.org; Sat, 07 Nov 2020 15:33:10 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kbUtS-0001D6-Ff for bug-guix@gnu.org; Sat, 07 Nov 2020 15:33:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:47772) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kbUtS-0006U3-5X for bug-guix@gnu.org; Sat, 07 Nov 2020 15:33:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kbUtS-0008A1-35 for bug-guix@gnu.org; Sat, 07 Nov 2020 15:33:02 -0500 X-Loop: help-debbugs@gnu.org Subject: bug#44353: guix system disk-image -t raw fails with grub-efi-bootloader Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sat, 07 Nov 2020 20:33:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44353 X-GNU-PR-Package: guix X-GNU-PR-Keywords: patch To: Mathieu Othacehe Received: via spool by 44353-submit@debbugs.gnu.org id=B44353.160478117831358 (code B ref 44353); Sat, 07 Nov 2020 20:33:02 +0000 Received: (at 44353) by debbugs.gnu.org; 7 Nov 2020 20:32:58 +0000 Received: from localhost ([127.0.0.1]:59318 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kbUtO-00089i-8P for submit@debbugs.gnu.org; Sat, 07 Nov 2020 15:32:58 -0500 Received: from mail-qv1-f42.google.com ([209.85.219.42]:37926) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kbUtN-00089S-FB for 44353@debbugs.gnu.org; Sat, 07 Nov 2020 15:32:57 -0500 Received: by mail-qv1-f42.google.com with SMTP id 13so2195824qvr.5 for <44353@debbugs.gnu.org>; Sat, 07 Nov 2020 12:32:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Uk/cerZKCtzPT3UZ/YXpw3/dNZImqqRboHRApO63oNw=; b=ij54lsj3BIZklmHL83SUaGR6mog8whQJfI0m9eVtu0hU+NqeSChJhTyKB8iSOFRN/G BpJFGV5IcCKiencJ7tFjOJAGyWBpsczcEX5Esw1cm2G9qW1t4xxKcsXpitu00bKIKX+H kvzzSUd3rwdADZBeinH3CWinHpUAZNH+A/JpjnhFHkeSHGUM1lO5TMWZhj3EsHxBKr18 duLxNmG/NuHcpPAt/wYWn91e1LBFaylcOVTotx0UPqT2YmLr6/kB2Ip7V0pq/nAWMCv6 GsML9I75Zg4K61Rk5tA0pFmDmyeeX4bb62FfKixLZXvQ50vQ7PW2zQnI6k8DPrw57jFG bafw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=Uk/cerZKCtzPT3UZ/YXpw3/dNZImqqRboHRApO63oNw=; b=jFS2vjsEFt5+5f3aOP/Gl/wFjAOB/aWGWUbGCYMpUAhhGxQs+lzoV2wMHwIj7OuBFw M/lp95pHzePELX7t/qeSH9WO5SwQXhReX3SeRrlDUTEgb8aktNlfKt4em1Dwd17mvl2r u5kBJHrCo7avMO7NFw23yhZIjv7qSwomncdhi2g2LNo7QVjrP48IzKV10AqD1oB7dV4x FT7CCdfzIEronGopAsr7QDSZdIA2IDiyFAZrlPsPvpWvMa8gh0WSiZE8Q0RAsjjcE9uk y9TmrN03vXEbqT2EkcgfSxzF6KA7u1KeXwts3KfirT0brSEr/OliRs1z40pm3hoQFTTe fMYA== X-Gm-Message-State: AOAM530CVPAbkwUuBjuM8OgyoW9pigVsnIp+7mjn+H0GZ4mtWtm3FCw7 4ah757eDlRFDsmbm8atheDkfU8FPteE= X-Google-Smtp-Source: ABdhPJzayzGb3DonAqunN0AB9jVeTxaFq35EXQIsH/kQtaX14moXoPTc17iL7HtZgQVFEu/s4DY9hg== X-Received: by 2002:a0c:9719:: with SMTP id k25mr5861521qvd.42.1604781171656; Sat, 07 Nov 2020 12:32:51 -0800 (PST) Received: from hurd (dsl-236-123-209.b2b2c.ca. [207.236.123.209]) by smtp.gmail.com with ESMTPSA id y3sm3008288qto.2.2020.11.07.12.32.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 07 Nov 2020 12:32:50 -0800 (PST) From: Maxim Cournoyer References: <1e589f3b-47f8-fd53-b750-d2beff8d91f5@gmail.com> <87lffdtzh1.fsf@gmail.com> <875z6hmt4b.fsf@gnu.org> Date: Sat, 07 Nov 2020 15:32:49 -0500 In-Reply-To: <875z6hmt4b.fsf@gnu.org> (Mathieu Othacehe's message of "Sat, 07 Nov 2020 10:08:36 +0100") Message-ID: <877dqwucum.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 44353@debbugs.gnu.org, Jesse Gibbons Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Scanner: ns3122888.ip-94-23-21.eu Authentication-Results: aspmx1.migadu.com; dkim=fail (headers rsa verify failed) header.d=gmail.com header.s=20161025 header.b=ij54lsj3; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: z70B+9zTyscc Hello Mathieu! Mathieu Othacehe writes: > Hello Maxim, > > Thanks for your patch! It's hard to provide a reliable abstraction on > top of all the exotic bootloader installation methods existing. > > Currently, each bootloader implements two methods: > > * bootloader-installer > * bootloader-disk-image-installer > > The first one is dedicated to the installation of the bootloader on a > mounted directory, while the second one is meant to work on a disk > device such as "/dev/sda" or directly on a disk-image. > > When producing a disk-image with the "raw" type, we are always creating > and populating an ESP partition (see raw-image-type), regardless of the > selected bootloader. In fact, "raw" should be renamed to "hybrid-efi". > > The produced image can work on machines with legacy mbr boot or with EFI > boot. Hence, calling "install-grub-efi" like it's done while building > the lightweight-desktop operating-system is useless and fails. The > attached patch fixes it. Thank you for the clarifications! > You can test it with: > > qemu-system-x86_64 -m 1024 -bios $(guix build > ovmf)/share/firmware/ovmf_x64.bin -hda disk.img Thank you! I hadn't realized that the default SeaBIOS BIOS used by QEMU wasn't EFI-capable! The image now boots, but fails bringing up its file systems for some reason. Perhaps I'm supposed to edit the file system definitions of the template before use? Here's how I tested it: $ time ./pre-inst-env guix system disk-image gnu/system/examples/lightweight-desktop.tmpl --verbosity=2 --no-offload That took 38 minutes on my system and produced /gnu/store/...-disk-image. $ cp /gnu/store/...-disk-image /tmp/lightweight-desktop.img $ chmod +rw /tmp/lightweight-desktop.img Then I tried running it with the suggested command: $ qemu-system-x86_64 -m 1024 -bios $(guix build ovmf)/share/firmware/ovmf_x64.bin -hda /tmp/lightweight-desktop.img >> + ;; Special case: most bootloaders can be copied >> + ;; directly at some fixed location on the image >> + ;; disk, but when installed to the master boot >> + ;; record (MBR), GRUB requires support files >> + ;; present under /boot/grub, which is handled by >> + ;; its 'installer' procedure. >> #:bootloader-installer >> - #+(bootloader-installer bootloader) >> + #+(if (eq? 'grub (bootloader-name bootloader)) >> + (bootloader-installer bootloader) >> + #f) > > That would prevent other bootloaders relying on this procedure to work, > such as extlinux. I pondered about such solution, but when I verified the bootloaders under gnu/bootloaders, it appeared that *only* the install-grub procedure supported being passed #f as its mount point; the others would fail because of the unexpected #f boolean value. For example, the install-extlinux procedure from (gnu bootloaders extlinux): --8<---------------cut here---------------start------------->8--- (define (install-extlinux mbr) #~(lambda (bootloader device mount-point) (let ((extlinux (string-append bootloader "/sbin/extlinux")) (install-dir (string-append mount-point "/boot/extlinux")) (syslinux-dir (string-append bootloader "/share/syslinux"))) (for-each (lambda (file) (install-file file install-dir)) (find-files syslinux-dir "\\.c32$")) (invoke/quiet extlinux "--install" install-dir) (write-file-on-device (string-append syslinux-dir "/" #$mbr) 440 device 0)))) --8<---------------cut here---------------end--------------->8--- Would break if device was set to #f, as is done in (guix build image)'s initialize-efi-partition: --8<---------------cut here---------------start------------->8--- (when bootloader-installer (display "installing bootloader...\n") (bootloader-installer bootloader-package #f root)) --8<---------------cut here---------------end--------------->8--- Is my analysis correct? If so, the patch I sent yesterday would fix the problem more thoroughly. Thank you, Maxim