GNU bug report logs - #65842
[PATCH 0/2] image: Introduce mbr-hybrid-raw image type.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Mathieu Othacehe <othacehe@HIDDEN>; Keywords: patch; Done: Mathieu Othacehe <mathieu@HIDDEN>; Maintainer for guix-patches is guix-patches@HIDDEN.
bug closed, send any further explanations to 65842 <at> debbugs.gnu.org and Mathieu Othacehe <othacehe@HIDDEN> Request was from Mathieu Othacehe <mathieu@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 65842 <at> debbugs.gnu.org:


Received: (at 65842) by debbugs.gnu.org; 9 Sep 2023 15:57:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 09 11:57:41 2023
Received: from localhost ([127.0.0.1]:48341 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qf0L6-0000LS-Sb
	for submit <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:57:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49086)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <othacehe@HIDDEN>) id 1qf0L4-0000L4-Nz
 for 65842 <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:57:39 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <othacehe@HIDDEN>) id 1qf0Kw-0003Ua-FL
 for 65842 <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:57:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To:
 From; bh=KmgfOa5oepfxGlu9rtgF2JhfVBIrvjYLpEc7enpxzEI=; b=WTgsb1UcfMnbowRMafQ2
 S4abvM8Pj+YnDX1dh7lO4zFnJ+JoQvR1+EfKpvm0OgCDxy4M/jykfKJFy51X5RC9syh65h+jacoin
 XJlI3CrMKpm+sQgRiP6d9KGQKOuahm5k9GN0xVE0tgtKkXpWGOGmlWrBydJdNF+jgqJjdtjPQDRsZ
 3TZ5Fk456TpU1JvAbzmgyDhPoc+pa1DnjzaJu11ePBLsywRDDWeuptcVoIt/MrbLNhF5ssqNutZRi
 PQca3B2nKRJfBt8M0gv1xpyyxo/S/457QgQd9QGGm0pSALNO3/jPRpHgNaguboEw/Sk+EQHJJ5Mpe
 +RUEkF3FWCnSCQ==;
From: Mathieu Othacehe <othacehe@HIDDEN>
To: 65842 <at> debbugs.gnu.org
Subject: [PATCH 1/2] image: Introduce the mbr-hybrid-raw image type.
Date: Sat,  9 Sep 2023 17:57:25 +0200
Message-Id: <65eda8765c093f29802e71f3972810b12e845c81.1694273927.git.othacehe@HIDDEN>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <cover.1694273927.git.othacehe@HIDDEN>
References: <cover.1694273927.git.othacehe@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65842
Cc: Mathieu Othacehe <othacehe@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Until 209204e23b39af09e0ea92540b6fa00a60e6a0ae and
d57cab764122af69d52d8cc9c843456044e5d7bc, the default image type used by "guix
system image" was an MBR image with an ESP partition.

Having both an MBR image and an ESP partition is handy because the image will
boot on most x86 based systems using legacy BIOS and/or UEFI.

We now have a distinction between MBR images and EFI images. Introduce a new
MBR hybrid image type and default to it to restore the default behaviour.

This also fixes the images section of (gnu ci) that was trying to install a
BIOS bootloader on an EFI, GPT image and failing to do so.
---
 doc/guix.texi           | 34 +++++++++++++++++++++++++++-------
 gnu/ci.scm              |  2 +-
 gnu/system/image.scm    | 14 ++++++++++++++
 guix/scripts/system.scm |  2 +-
 4 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 339dcb2a41..22135254ea 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -40912,8 +40912,8 @@ Invoking guix system
 @cindex image, creating disk images
 The @code{image} command can produce various image types.  The image
 type can be selected using the @option{--image-type} option.  It
-defaults to @code{mbr-raw}.  When its value is @code{iso9660}, the
-@option{--label} option can be used to specify a volume ID with
+defaults to @code{mbr-hybrid-raw}.  When its value is @code{iso9660},
+the @option{--label} option can be used to specify a volume ID with
 @code{image}.  By default, the root file system of a disk image is
 mounted non-volatile; the @option{--volatile} option can be provided to
 make it volatile instead.  When using @code{image}, the bootloader
@@ -40931,8 +40931,8 @@ Invoking guix system
                    -bios $(guix build ovmf)/share/firmware/ovmf_x64.bin
 @end example
 
-When using the @code{mbr-raw} image type, a raw disk image is produced;
-it can be copied as is to a USB stick, for instance.  Assuming
+When using the @code{mbr-hybrid-raw} image type, a raw disk image is
+produced; it can be copied as is to a USB stick, for instance.  Assuming
 @code{/dev/sdc} is the device corresponding to a USB stick, one can copy
 the image to it using the following command:
 
@@ -41069,7 +41069,7 @@ Invoking guix system
 For the @code{image} action, create an image with given @var{type}.
 
 When this option is omitted, @command{guix system} uses the
-@code{mbr-raw} image type.
+@code{mbr-hybrid-raw} image type.
 
 @cindex ISO-9660 format
 @cindex CD image format
@@ -45277,7 +45277,7 @@ System Images
 
 The @command{guix system image} command is able to turn an operating
 system definition into a bootable image.  This command supports
-different image types, such as @code{mbr-raw}, @code{iso9660} and
+different image types, such as @code{mbr-hybrid-raw}, @code{iso9660} and
 @code{docker}.  Any modern @code{x86_64} machine will probably be able
 to boot from an @code{iso9660} image.  However, there are a few machines
 out there that require specific image types.  Those machines, in general
@@ -45541,8 +45541,24 @@ Instantiate an Image
 system image)} module provides the following @code{image} definition
 variables.
 
+@defvar mbr-disk-image
+An MBR disk-image composed of a single ROOT partition.  The ROOT
+partition starts at a 1@tie{}MiB offset so that the bootloader can
+install itself in the post-MBR gap.
+@end defvar
+
+@defvar mbr-hybrid-disk-image
+An MBR disk-image composed of two partitions: a 64 bits ESP partition
+and a ROOT boot partition.  The ESP partition starts at a 1@tie{}MiB
+offset so that a BIOS compatible bootloader can install itself in the
+post-MBR gap.  The image can be used by @code{x86_64} and @code{i686}
+machines supporting only legacy BIOS booting.  The ESP partition ensures
+that it can also be used by newer machines relying on UEFI booting,
+hence the @emph{hybrid} denomination.
+@end defvar
+
 @defvar efi-disk-image
-A MBR disk-image composed of two partitions: a 64 bits ESP partition and
+A GPT disk-image composed of two partitions: a 64 bits ESP partition and
 a ROOT boot partition.  This image can be used on most @code{x86_64} and
 @code{i686} machines, supporting BIOS or UEFI booting.
 @end defvar
@@ -45633,6 +45649,10 @@ image-type Reference
 Build an image based on the @code{mbr-disk-image} image.
 @end defvar
 
+@defvar mbr-hybrid-raw-image-type
+Build an image based on the @code{mbr-hybrid-disk-image} image.
+@end defvar
+
 @defvar efi-raw-image-type
 Build an image based on the @code{efi-disk-image} image.
 @end defvar
diff --git a/gnu/ci.scm b/gnu/ci.scm
index 520ac28110..279dd4d910 100644
--- a/gnu/ci.scm
+++ b/gnu/ci.scm
@@ -268,7 +268,7 @@ (define* (image-jobs store system
     (if (member system %guix-system-supported-systems)
         `(,(image->job store
                        (image
-                        (inherit efi-disk-image)
+                        (inherit mbr-hybrid-disk-image)
                         (operating-system installation-os))
                        #:name "usb-image"
                        #:system system)
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 5b8da2f896..b1b928b222 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -77,6 +77,7 @@ (define-module (gnu system image)
             root-partition
 
             mbr-disk-image
+            mbr-hybrid-disk-image
             efi-disk-image
             iso9660-image
             docker-image
@@ -86,6 +87,7 @@ (define-module (gnu system image)
 
             image-with-os
             mbr-raw-image-type
+            mbr-hybrid-raw-image-type
             efi-raw-image-type
             efi32-raw-image-type
             qcow2-image-type
@@ -156,6 +158,13 @@ (define mbr-disk-image
            (inherit root-partition)
            (offset root-offset))))))
 
+(define mbr-hybrid-disk-image
+  (image-without-os
+   (format 'disk-image)
+   (partition-table-type 'mbr)
+   (partitions
+    (list esp-partition root-partition))))
+
 (define efi-disk-image
   (image-without-os
    (format 'disk-image)
@@ -217,6 +226,11 @@ (define mbr-raw-image-type
    (name 'mbr-raw)
    (constructor (cut image-with-os mbr-disk-image <>))))
 
+(define mbr-hybrid-raw-image-type
+  (image-type
+   (name 'mbr-hybrid-raw)
+   (constructor (cut image-with-os mbr-hybrid-disk-image <>))))
+
 (define efi-raw-image-type
   (image-type
    (name 'efi-raw)
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index ec331809ef..547387d5e1 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -1169,7 +1169,7 @@ (define %default-options
     (debug . 0)
     (verbosity . #f)                              ;default
     (validate-reconfigure . ,ensure-forward-reconfigure)
-    (image-type . mbr-raw)
+    (image-type . mbr-hybrid-raw)
     (image-size . guess)
     (install-bootloader? . #t)
     (label . #f)
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#65842; Package guix-patches. Full text available.

Message received at 65842 <at> debbugs.gnu.org:


Received: (at 65842) by debbugs.gnu.org; 9 Sep 2023 15:57:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 09 11:57:40 2023
Received: from localhost ([127.0.0.1]:48339 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qf0L6-0000LN-HI
	for submit <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:57:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:49100)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <othacehe@HIDDEN>) id 1qf0L5-0000L6-0Q
 for 65842 <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:57:39 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <othacehe@HIDDEN>) id 1qf0Kw-0003Ug-Pb
 for 65842 <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:57:30 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To:
 From; bh=d/JkcrQOxVr6Rzja5ilKAwzIawmYhaHC+Dk7MX/RbqA=; b=D5GU1hvFeAQNEfkNLYmF
 fXAk8IbYHbk2/fbNpDSAPlckcL8yVIynBi6jhgv3PJuW07TGAVhfpnzwF0e0E67eSFBFLChdzB76C
 COXjVh46UuBCeSOruPYwFjcZ8JmsSBSACsHHsRLnvXY51Bg9mnyLA0DqKORUH3baqKXwkPYH2Vgvg
 5+KQ7fmINWm3itMvtaoK+TyiDPqE0tG81CGBpxLPQBTkYZ4jXnOjym3WIBeuStHu/l0QhBmLLEb2I
 P1sx6f5w/L/7ZktUXdT0mAmABXVx6Ep5SAGHaXwFixGY8vmAfcy9f65Oi4XhYnODHOjbJ+uWw0oDb
 B2wqvWF4XEd96Q==;
From: Mathieu Othacehe <othacehe@HIDDEN>
To: 65842 <at> debbugs.gnu.org
Subject: [PATCH 2/2] image: Do not allow BIOS bootloader and GPT.
Date: Sat,  9 Sep 2023 17:57:26 +0200
Message-Id: <627b212f6b5bf9fd412e8c899b67b031cb1c4a00.1694273927.git.othacehe@HIDDEN>
X-Mailer: git-send-email 2.38.1
In-Reply-To: <cover.1694273927.git.othacehe@HIDDEN>
References: <cover.1694273927.git.othacehe@HIDDEN>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 65842
Cc: Mathieu Othacehe <othacehe@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

When using grub-bootloader with a GPT image, GRUB will fail during
installation with a cryptic error message.

* gnu/system/image.scm (system-disk-image): Raise an error when trying to use
a non-EFI compatible bootloader with a GPT image partitioning.
---
 gnu/system/image.scm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index b1b928b222..fa4cab0b03 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -530,6 +530,13 @@ (define* (system-disk-image image
                 (image-partition-table-type image)))
        (else "")))
 
+    (when (and (gpt-image? image)
+               (not
+                (memq (bootloader-name bootloader) '(grub-efi grub-efi32))))
+      (raise
+       (formatted-message
+        (G_ "EFI bootloader required with GPT partitioning"))))
+
     (let* ((format (image-format image))
            (image-type (format->image-type format))
            (image-type-options (genimage-type-options image-type image))
-- 
2.38.1





Information forwarded to guix-patches@HIDDEN:
bug#65842; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Sep 2023 15:51:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 09 11:51:23 2023
Received: from localhost ([127.0.0.1]:48326 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1qf0F0-0000Bg-UO
	for submit <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:51:23 -0400
Received: from lists.gnu.org ([2001:470:142::17]:38554)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <othacehe@HIDDEN>) id 1qf0Ex-0000BR-0s
 for submit <at> debbugs.gnu.org; Sat, 09 Sep 2023 11:51:21 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <othacehe@HIDDEN>) id 1qf0Eo-000501-A9
 for guix-patches@HIDDEN; Sat, 09 Sep 2023 11:51:10 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <othacehe@HIDDEN>) id 1qf0Eo-00025Y-1u
 for guix-patches@HIDDEN; Sat, 09 Sep 2023 11:51:10 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to:
 references; bh=jYNs4q4c4yQVpG/kTOJo2b1bW4Qhimga2AFfeIy4dwc=; b=DLC80EUKz0l4uL
 1dzSqx0F6tKrV85ALVax38ZAGOLhRb78WAq5eqcqIkPAmSJFYzrS7tu4LU2Ij91OoZwvJNYHgMuWs
 WI/YqKOMMryDvg0lmdAZbaZaEitN5wBzkj13ce0yUwlmMoxs5VyZ7SO1IBWKiNa2nOjzJByYoo8u4
 gJaMO/1F2kdtdMsr/xOTyBq+Wh1ZjxW/udrlVVVTZIyljXwvAYv4aQ7NfedZOlSku5xOH9Iv2LwVT
 mA+t6kM0oNU57ZPPZl/xrsWIbMlsPlRwHa419q/ZMGbLiYPvYXAhHdQiJ+InxIgDjcUO/pO8YVyMz
 z1ytCmu13ZxzRBTWjdSQ==;
From: Mathieu Othacehe <othacehe@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 0/2] image: Introduce mbr-hybrid-raw image type.
Date: Sat,  9 Sep 2023 17:51:05 +0200
Message-Id: <cover.1694273927.git.othacehe@HIDDEN>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: submit
Cc: Mathieu Othacehe <othacehe@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hello,

Recent commits have changed the defaut behaviour of the "guix system image"
command that was to produce a "hybrid" image: MBR partitioned but with an ESP
partition.

Establish a clear distinction between MBR, MBR-hybrid and EFI image types.

Thanks,

Mathieu

Mathieu Othacehe (2):
  image: Introduce the mbr-hybrid-raw image type.
  image: Do not allow BIOS bootloader and GPT.

 doc/guix.texi           | 34 +++++++++++++++++++++++++++-------
 gnu/ci.scm              |  2 +-
 gnu/system/image.scm    | 21 +++++++++++++++++++++
 guix/scripts/system.scm |  2 +-
 4 files changed, 50 insertions(+), 9 deletions(-)


base-commit: 8d9bb5408a5088304ec8662bb53b9c3ded9ca725
-- 
2.38.1





Acknowledgement sent to Mathieu Othacehe <othacehe@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#65842; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 20 Sep 2023 08:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.