GNU bug report logs - #62223
[PATCH] image: Prefer gpt partition table for efi disk images

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: Sergey Trofimov <sarg@HIDDEN>; Keywords: patch; dated Thu, 16 Mar 2023 17:39:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

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


Received: (at 62223) by debbugs.gnu.org; 22 Mar 2023 12:53:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 08:53:35 2023
Received: from localhost ([127.0.0.1]:33802 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pexyB-0002y8-FJ
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2023 08:53:35 -0400
Received: from mail-ed1-f53.google.com ([209.85.208.53]:34731)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sarg@HIDDEN>) id 1pexy9-0002xu-59
 for 62223 <at> debbugs.gnu.org; Wed, 22 Mar 2023 08:53:33 -0400
Received: by mail-ed1-f53.google.com with SMTP id b20so39563634edd.1
 for <62223 <at> debbugs.gnu.org>; Wed, 22 Mar 2023 05:53:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1679489607;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=oi9kOQOPJjJ59xt8hinWk8GxnLwItG5vafMwsZ6DurY=;
 b=Lop8iRs1D4ThaJiIiq2XdwZsrb8jAccAGvr5Ps+FVM9uGTTRQlpvmAGCz86qQH8wlT
 qfjYVA8gpGEFBQptBVIHYjeesGoF1Dc/0QCIXNsIb304T/2VcLw7GmX1V28yT7j5Mrxx
 +NJTHrYH4YD8V5GatzMfGTaAX1X0bEZWyuTV4=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679489607;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=oi9kOQOPJjJ59xt8hinWk8GxnLwItG5vafMwsZ6DurY=;
 b=lGtsLZv+jGJEKSPhEM/tlBU6OShWPlsOZJfgTjbn3dF7pFEKY9eG4qidznak1Qyg7J
 M64XXvwlbCKPkNM3sw3yTcbzKI/FuUoSJYWUG3jhq4J2TxY+OTov37hjsA1BmS+Aulrm
 oOlFRoPOw6Uo/P93IcvvqxMzGFRUX5fiASs8zNgV6f7ioNLMlK3vu68cElsNvmCZnUZh
 D9gZWbMC8jYdeoTLJQr2Q9eTe6adH7ga3HluVqsYkpHWiPeGlPNWJI7cwpHS3mUA5RpU
 BuW6NGqrNI8xQ11wNCV7N+xgDc5GC/xgfqLhlp3mGH/0ltmlOtvvmnBmizBKmza9YBPo
 9Bnw==
X-Gm-Message-State: AO0yUKUZx3C/v6QA+MvspT/jtNoEaCfhcudW5jWgOEEuX5jk5PVSJ287
 Wwd9ORxLJAhEfgmg4+D4OVCH6rXl00qllvG+FXlOtA==
X-Google-Smtp-Source: AK7set91rvlpvJuYs9ScWntqAF2zi9WuGT2EppSGG9CBG5gHxre27EqOOy3/2SLDZsVT8u1Jk6DuiA==
X-Received: by 2002:a17:906:32c4:b0:932:40f4:5c44 with SMTP id
 k4-20020a17090632c400b0093240f45c44mr6828632ejk.36.1679489607179; 
 Wed, 22 Mar 2023 05:53:27 -0700 (PDT)
Received: from localhost ([95.168.147.255]) by smtp.gmail.com with ESMTPSA id
 v2-20020a170906292200b009321cd80e15sm6803105ejd.73.2023.03.22.05.53.26
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 22 Mar 2023 05:53:27 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: 62223 <at> debbugs.gnu.org
Subject: [PATCH v2] image: Prefer gpt partition table for efi images
Date: Wed, 22 Mar 2023 13:53:28 +0100
Message-Id: <20230322125328.23578-1-sarg@HIDDEN>
X-Mailer: git-send-email 2.39.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62223
Cc: Josselin Poiret <dev@HIDDEN>, Sergey Trofimov <sarg@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 (-)

* gnu/system/image.scm (efi-disk-image): Use gpt partition-table-type.
(efi32-disk-image): Use gpt partition-table-type.
(qcow2-image-type): Use mbr partition-table-type explicitly.
* gnu/tests/image.scm: Assert partition table type of efi-disk-image.
---
 gnu/system/image.scm |  3 +++
 gnu/tests/image.scm  | 23 ++++++++++++++++++-----
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..699feaf05d 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -147,11 +147,13 @@ (define root-partition
 (define efi-disk-image
   (image-without-os
    (format 'disk-image)
+   (partition-table-type 'gpt)
    (partitions (list esp-partition root-partition))))
 
 (define efi32-disk-image
   (image-without-os
    (format 'disk-image)
+   (partition-table-type 'gpt)
    (partitions (list esp32-partition root-partition))))
 
 (define iso9660-image
@@ -214,6 +216,7 @@ (define qcow2-image-type
    (constructor (cut image-with-os
                  (image
                   (inherit efi-disk-image)
+                  (partition-table-type 'mbr)
                   (name 'image.qcow2)
                   (format 'compressed-qcow2))
                  <>))))
diff --git a/gnu/tests/image.scm b/gnu/tests/image.scm
index 99d34b7670..be6852cae0 100644
--- a/gnu/tests/image.scm
+++ b/gnu/tests/image.scm
@@ -20,7 +20,7 @@ (define-module (gnu tests image)
   #:use-module (gnu)
   #:use-module (gnu image)
   #:use-module (gnu tests)
-  #:autoload   (gnu system image) (system-image root-offset)
+  #:autoload   (gnu system image) (system-image root-offset image-with-os efi-disk-image)
   #:use-module (gnu system uuid)
   #:use-module (gnu system vm)
   #:use-module (gnu packages guile)
@@ -153,6 +153,10 @@ (define i5
       (flags '(boot))
       (initializer dummy-initializer))))))
 
+;; A efi disk image with default partitions
+(define i6
+  (image-with-os efi-disk-image %simple-efi-os))
+
 (define (run-images-test)
   (define test
     (with-imported-modules '((srfi srfi-64)
@@ -202,10 +206,10 @@ (define d2-device
               (disk-get-primary-partition-count (disk-new d2-device)))
 
             (test-equal "test"
-                (let* ((disk (disk-new d2-device))
-                       (partitions (disk-partitions disk))
-                       (boot-partition (find normal-partition? partitions)))
-                  (partition-get-name boot-partition)))
+              (let* ((disk (disk-new d2-device))
+                     (partitions (disk-partitions disk))
+                     (boot-partition (find normal-partition? partitions)))
+                (partition-get-name boot-partition)))
 
             ;; Image i3.
             (define i3-image
@@ -259,6 +263,15 @@ (define (sector->byte sector)
                    (filter data-partition?
                            (disk-partitions (disk-new d5-device)))))
 
+            ;; Image i6.
+            (define i6-image
+              #$(system-image i6))
+            (define d6-device
+              (get-device i6-image))
+
+            (test-equal "gpt"
+              (disk-type-name (disk-probe d6-device)))
+
             (test-end)))))
 
   (gexp->derivation "images-test" test))
-- 
2.39.2





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

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


Received: (at 62223) by debbugs.gnu.org; 22 Mar 2023 12:50:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 08:50:35 2023
Received: from localhost ([127.0.0.1]:33785 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pexvG-0002st-W5
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2023 08:50:35 -0400
Received: from mail-ed1-f41.google.com ([209.85.208.41]:35530)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sarg@HIDDEN>) id 1pexvE-0002sd-76
 for 62223 <at> debbugs.gnu.org; Wed, 22 Mar 2023 08:50:34 -0400
Received: by mail-ed1-f41.google.com with SMTP id y4so72548301edo.2
 for <62223 <at> debbugs.gnu.org>; Wed, 22 Mar 2023 05:50:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1679489426;
 h=mime-version:message-id:in-reply-to:date:subject:cc:to:from
 :user-agent:references:from:to:cc:subject:date:message-id:reply-to;
 bh=hhfIagDIu/xq+i5BSznteeXTywGyBs8qrvaDcBjRfzo=;
 b=h4tk8gbNRMFNNZAN1MMPZtDwoMwrLwKJwbZEQjq4eOoR+bOxFQzCmIOUSewImD3BP0
 xz/OtI33b4BqIaiECNSOteiSNXSIiUa2UTfxJhZ4P/6kgGodEabnEO8A8UrIn+BKMl8O
 66esRJsae0AIWdFRkTs0lgJt4SBhj4pTE5nMg=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679489426;
 h=mime-version:message-id:in-reply-to:date:subject:cc:to:from
 :user-agent:references:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=hhfIagDIu/xq+i5BSznteeXTywGyBs8qrvaDcBjRfzo=;
 b=QVGGK+UB21ta/saNxkJfbh8siXQD4uVRquINOfBQzoaeHe9KwGV/JbxWYyCFZl53sq
 ogwPF7pXVZ4EEYQbJXUUZhCMLfOAZcegNVKzgc5oThEnyQ7Ymj9ixoqscgouHD2bQ5WD
 dqiR7c8Jyf9l93sfM0u4+j7O8npI+5psT4RHh7WpuiY/V3b3XcerDmwViJ/iG5YowjSK
 uFVIW6XHeeweqJFug1kRgKF23ezyv2B0naUIRZkgT8S5mydfSqBEs8KVYZ62q7O31LYL
 DqrM/3p74sraazOX6NzJewXILNvZrfzNoIBuES6JPeBGexFfVriYqWhfZUEDKellgC7z
 SYsw==
X-Gm-Message-State: AO0yUKV9u7Wpr6QnT3utEJmMLb/yq+X3L91xH3mqSwb9mfZMDIDFr41o
 Os6jJXuFlqLAyaVgH5vJ5L4EcA==
X-Google-Smtp-Source: AK7set/H+bGeTxyMfRQtcruvRArIBitnfXqY4czlvhO9jcxDYCiG6VpJKLbbljVyYxBbh7IS3Re71g==
X-Received: by 2002:a05:6402:8d9:b0:4f9:deb4:b986 with SMTP id
 d25-20020a05640208d900b004f9deb4b986mr6060759edz.7.1679489426131; 
 Wed, 22 Mar 2023 05:50:26 -0700 (PDT)
Received: from localhost ([95.168.147.255]) by smtp.gmail.com with ESMTPSA id
 s29-20020a50d49d000000b004fc2a75c6b3sm7638712edi.23.2023.03.22.05.50.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 22 Mar 2023 05:50:25 -0700 (PDT)
References: <20230316173137.25074-1-sarg@HIDDEN>
 <87mt45rdcy.fsf@HIDDEN>
User-agent: mu4e 1.8.13; emacs 29.0.60
From: Sergey Trofimov <sarg@HIDDEN>
To: Josselin Poiret <dev@HIDDEN>
Subject: Re: [bug#62223] [PATCH] image: Prefer gpt partition table for efi
 disk images
Date: Wed, 22 Mar 2023 13:48:47 +0100
In-reply-to: <87mt45rdcy.fsf@HIDDEN>
Message-ID: <87a605c5lj.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62223
Cc: 62223 <at> debbugs.gnu.org
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 (-)


Josselin Poiret <dev@HIDDEN> writes:

> [[PGP Signed Part:Undecided]]
> Hi Sergey,
>
> Thanks for the patch!  First off, if you want to add a comment 
> to your
> mail but not to the commit message, you should add it below the 
> first --
> (under the commit message), before the diff, that way it doesn't 
> end up
> in the commit message.
>

Thanks, noted.

>
> With this applied, I cannot build an example qcow2 image using 
> `guix
> system image -t qcow2 gnu/system/examples/bare-bones.tmpl`.  It 
> fails
> when installing GRUB onto the image.  Sure enough, the
> install-grub-disk-image procedure seems to only support MBR. 
> Could you
> also have a look at this?

Yeah, I'm glad you've caught that. qcow2 should be mbr style by 
default. I'll send a v2 for that.




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

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


Received: (at 62223) by debbugs.gnu.org; 22 Mar 2023 08:22:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 22 04:22:37 2023
Received: from localhost ([127.0.0.1]:33406 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1petjx-000564-7g
	for submit <at> debbugs.gnu.org; Wed, 22 Mar 2023 04:22:37 -0400
Received: from mail-ed1-f46.google.com ([209.85.208.46]:40883)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sarg@HIDDEN>) id 1petju-00055q-Kp
 for 62223 <at> debbugs.gnu.org; Wed, 22 Mar 2023 04:22:36 -0400
Received: by mail-ed1-f46.google.com with SMTP id ew6so6476061edb.7
 for <62223 <at> debbugs.gnu.org>; Wed, 22 Mar 2023 01:22:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1679473348;
 h=mime-version:message-id:date:subject:to:from:user-agent:from:to:cc
 :subject:date:message-id:reply-to;
 bh=vaOce3MlvJszZavNLbxMUz+lN297aG4RFka+rEBsE7M=;
 b=K3Tui+41+s+y7s5XxFDGJbMO5f7yPK4hgpVGVduXlJrxz3f4E0zCi0jYj1Hni7LnM+
 QTKMFrLwVP470AzApp+kD8CBL+oQr7CERkF8/WwI3oV4PalYFIFp8WJTPP+FdDSnzZ5+
 Jl0rvYghlMhzHnDabf+as+mO7V1dZn/icEVYI=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1679473348;
 h=mime-version:message-id:date:subject:to:from:user-agent
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=vaOce3MlvJszZavNLbxMUz+lN297aG4RFka+rEBsE7M=;
 b=W/hjuLse+H+o0b16avVCJyVpC6YcAdypxf/xNL3DRrPsNYhvgsSenbS9y65+9LsfN+
 Thhu9US+JRu20GUR+X2Kn3GEU0iKUghHw53BFZDpfRzZblvLIBjj9a3su82wNd1D35Ge
 y4iIKRRphMrNDy4TIFbZb2aYEfQtxemARHPngpE7TnHKL2lVHx3tGQMb3sB8DQ0jStbp
 JBmv44jtVhFSsxJj1n1evz8aHKfj+idsvT480FeOYiCSM7uaeR1b5O14A0G0xpCls9UQ
 SEpfnp75MyRvcnGLG0eXUgOD8YCbjuVR7LkW2tahqDAs7IuwcDPLExZ/tdxhimbMWhIF
 Px1g==
X-Gm-Message-State: AO0yUKXckJam+RN0Ta3yFRx2hKrganyULm3hq4BEb806J9omIyMocFtv
 iQ9nhVKh2mQ3iEMbizJO/CaLR90JWqz+hw8TjSHTOA==
X-Google-Smtp-Source: AK7set/BTMSGpDAltB25l6etKvSDu2DBB6ZtthzJbiaZSbRHfzb1565GOBpyqFPmyKnJT8LAXn4VLg==
X-Received: by 2002:a17:906:5a8f:b0:931:41af:8ecb with SMTP id
 l15-20020a1709065a8f00b0093141af8ecbmr5703418ejq.49.1679473348326; 
 Wed, 22 Mar 2023 01:22:28 -0700 (PDT)
Received: from localhost ([95.168.147.255]) by smtp.gmail.com with ESMTPSA id
 gu12-20020a170906f28c00b008b17de9d1f2sm6972977ejb.15.2023.03.22.01.22.27
 for <62223 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 22 Mar 2023 01:22:28 -0700 (PDT)
User-agent: mu4e 1.8.13; emacs 29.0.60
From: Sergey Trofimov <sarg@HIDDEN>
To: 62223 <at> debbugs.gnu.org
Subject: Tested locally
Date: Wed, 22 Mar 2023 09:14:13 +0100
Message-ID: <87fs9x5h5x.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62223
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 (-)


I have created an image and verified that it boots on qemu with 
proper bios.
Then I've baked an image of my real system configuration and used 
it to reprovision my laptop.

vm.scm
--8<---------------cut here---------------start------------->8---
...
  (bootloader
   (bootloader-configuration
    (bootloader grub-efi-bootloader)
    (targets '("/boot"))))
  (file-systems
   (cons*
    (file-system
      (mount-point "/")
      (device (file-system-label "Guix_image"))
      (type "ext4"))
    (file-system
      (mount-point "/boot")
      (device (file-system-label "GNU-ESP"))
      (type "vfat"))
    %base-file-systems))
...
--8<---------------cut here---------------end--------------->8---

testing it with:
--8<---------------cut here---------------start------------->8---
guix system image --image-type=efi-raw vm.scm

qemu-system-x86_64 \
    -bios $(guix build ovmf)/share/firmware/ovmf_x64.bin \
    -drive file=$HOME/vm.img,if=virtio
--8<---------------cut here---------------end--------------->8---




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

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


Received: (at 62223) by debbugs.gnu.org; 21 Mar 2023 21:41:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 21 17:41:58 2023
Received: from localhost ([127.0.0.1]:32822 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pejjx-0003Mk-LY
	for submit <at> debbugs.gnu.org; Tue, 21 Mar 2023 17:41:57 -0400
Received: from jpoiret.xyz ([206.189.101.64]:35484)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dev@HIDDEN>) id 1pejjv-0003Mb-I1
 for 62223 <at> debbugs.gnu.org; Tue, 21 Mar 2023 17:41:56 -0400
Received: from authenticated-user (jpoiret.xyz [206.189.101.64])
 by jpoiret.xyz (Postfix) with ESMTPA id 8AFEC184D43;
 Tue, 21 Mar 2023 21:41:53 +0000 (UTC)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jpoiret.xyz; s=dkim;
 t=1679434913;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 in-reply-to:in-reply-to:references:references;
 bh=Wn64fj6KdOZrxrHKEuPrKTkhbN4zZnmQpZKFmDCK268=;
 b=TxGMUI99uh4awD5NdZb73Yi000Wr7mRj5VAsdC1RIK0lzPnAa3XsLbTJ7LF7mlGY4nJD+V
 N2qeSOiVlq2Xpft390+C6xXZO4H/V6ow3sMPeLx2pqroBGsEGitDswMvi3ffYYyu809kWH
 G3UE+VbG5f09Mkcyir7XSIshORSVsdeHLvS20xEiUJ37iepF4c/QntICVEZiMAK3EmIQsT
 S3gpZcqfN1Rffee7NA49vkNQG7CuOIIS/AcDqbLSO49aLflKkk56pQ/zlLMymqeVhieLdU
 OCbXcDkSrHvtvzmcx2HhNKkh4nhgFJO6XpjRcvUBJgWlmkw0ke1Fv1z3dyQb8A==
From: Josselin Poiret <dev@HIDDEN>
To: Sergey Trofimov <sarg@HIDDEN>, 62223 <at> debbugs.gnu.org
Subject: Re: [bug#62223] [PATCH] image: Prefer gpt partition table for efi
 disk images
In-Reply-To: <20230316173137.25074-1-sarg@HIDDEN>
References: <20230316173137.25074-1-sarg@HIDDEN>
Date: Tue, 21 Mar 2023 22:41:49 +0100
Message-ID: <87mt45rdcy.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha256; protocol="application/pgp-signature"
Authentication-Results: jpoiret.xyz;
 auth=pass smtp.auth=jpoiret@HIDDEN smtp.mailfrom=dev@HIDDEN
X-Spamd-Bar: /
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 62223
Cc: Sergey Trofimov <sarg@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: 0.0 (/)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi Sergey,

Sergey Trofimov <sarg@HIDDEN> writes:

> Hi guix, I got curious, what the easiest way to migrate existing guix os =
to a
> new machine could be, and I've came to a conclusion that `guix system ima=
ge`
> fits this scenario perfectly. So I've tried to run `guix system image
> --image-type=3Defi-raw --persistent --save-provenance system.scm`, but the
> resulting image contained MBR style partition table. Although MBR support=
 is a
> must for an UEFI implementor, a better choice would be to use GPT style t=
able.

Thanks for the patch!  First off, if you want to add a comment to your
mail but not to the commit message, you should add it below the first --
(under the commit message), before the diff, that way it doesn't end up
in the commit message.

With this applied, I cannot build an example qcow2 image using `guix
system image -t qcow2 gnu/system/examples/bare-bones.tmpl`.  It fails
when installing GRUB onto the image.  Sure enough, the
install-grub-disk-image procedure seems to only support MBR.  Could you
also have a look at this?

Best,
=2D-=20
Josselin Poiret

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQHEBAEBCAAuFiEEOSSM2EHGPMM23K8vUF5AuRYXGooFAmQaJJ0QHGRldkBqcG9p
cmV0Lnh5egAKCRBQXkC5Fhcaiv8YC/470ny/Qo4JeARKij0gKV4uwhHYYOtwB2r/
sqOZEHrqWi/zmZHJhm/CJtnqesyi3SVy9p/38TPdnXN6q06UU/OPQH1BMaF7QQNM
1LSCnImkCvvrpYHYu1tABz4UVnH3UqouYSrYEo8+Xujvnb2njniQgJWb9rrSuVjB
MwnMl0bqI6QtEisV7DVjMOyWWgIMHZkmavWOcn+A3ppmBDQ+vVF8QKbvdlpvF0+f
USG22Nl1ufslE/55F5S1p+rzR+DE1v46UXP/lWxtMhsTaBa4h37ldVe9weJsMLlM
2jKHYe6OvS8yHeqBn6NBxQy0oTnAQa952poJS7nAXAt5CG5QBOQKo1gWbOxtxDfe
HQ0NP1vmxdsxf0S3m0+DI7u9gXWiAK1nRNYy/XtD3DBIbYg2+pQgwuflIqZu2lC6
3a4BP+8cOVfJ4J5EHjoAVB6u1d0BFMhwI8bVTeumeP0RPhunSMYpbT3QHVA+lzYi
rpLTwfEhZ+gZlDJ/j8tLfrqf6vercWo=
=SMjj
-----END PGP SIGNATURE-----
--=-=-=--




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

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


Received: (at submit) by debbugs.gnu.org; 16 Mar 2023 17:38:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 16 13:38:30 2023
Received: from localhost ([127.0.0.1]:42870 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pcrYc-00079h-Fe
	for submit <at> debbugs.gnu.org; Thu, 16 Mar 2023 13:38:30 -0400
Received: from lists.gnu.org ([209.51.188.17]:44462)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sarg@HIDDEN>) id 1pcrYb-00079a-Mm
 for submit <at> debbugs.gnu.org; Thu, 16 Mar 2023 13:38:30 -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 <sarg@HIDDEN>) id 1pcrYb-0000ph-3C
 for guix-patches@HIDDEN; Thu, 16 Mar 2023 13:38:29 -0400
Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <sarg@HIDDEN>) id 1pcrYY-0005Fh-Ju
 for guix-patches@HIDDEN; Thu, 16 Mar 2023 13:38:28 -0400
Received: by mail-ed1-x52a.google.com with SMTP id y4so10760439edo.2
 for <guix-patches@HIDDEN>; Thu, 16 Mar 2023 10:38:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=sarg.org.ru; s=google; t=1678988302;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=xnMcbFMdUZNNgUHJ2BxbWhgdbglB0dv0kxjl2M14eVA=;
 b=dFuwDgNG4kp4gv17u2VTvv4DY673JwuKEAvDA8M1GRVg1Xz+K2v+sU/x+DWMFfimVs
 WqwpwCXCSsgaxdjptkkIq86ZaEx9LidlV2fx7v7rH0/kKeBugOrL7tOGXSBreBPKWLhi
 ZMzy9aF/E/5oibo8bajdIirlE3YIMxVEAZOTo=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112; t=1678988302;
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:x-gm-message-state:from:to:cc:subject:date:message-id
 :reply-to;
 bh=xnMcbFMdUZNNgUHJ2BxbWhgdbglB0dv0kxjl2M14eVA=;
 b=paqG3XvzlXTsbYsiZkW7vDOGUxJdJP1hZ5oFUip+I7/2GxUi9oV9h8Q66yulKNeV0l
 Y63ZPC++mEs1B3ZP7OEtWsKOKEIaTcdGLsXItmhgFr+eusFd2MHpMTGYCnwjdRQYey1v
 Beaa5+WWHd0vaVND4pUTbHLkqMuXfCUoCjDwyGTM9eUWB5J9ZbhbsNJDKP5BYIRQrlzH
 9m+wi6xbR2BeXMDea8vbq+/ws51zXj5aF7OetamOAvCpGAkv0uucHFsvQ74ToJVBwZmp
 gzjDZvHHvH2ERRUQhFAKilWuJWqdxM5PHK0Yw9vi1G92z7MqhnJIFZ4nNVw5Px3ZkuDe
 hSJA==
X-Gm-Message-State: AO0yUKX2VR1hcG6avd3zmcSwGSLWsldr24r0ddiGF2//4ty9oHlOmbCL
 FmWRIOga/EDuzpUNNPYGby6PTX7qyBPDx4+6T7U=
X-Google-Smtp-Source: AK7set947OKIQwRHx4shKegf8KlKP1N/kTCwbmh1n43WBuS+V6IH4hp2NgZ9vZXHwzkCl1HQkiR+LQ==
X-Received: by 2002:a17:907:7baa:b0:931:3a85:d0bf with SMTP id
 ne42-20020a1709077baa00b009313a85d0bfmr1433704ejc.17.1678988302515; 
 Thu, 16 Mar 2023 10:38:22 -0700 (PDT)
Received: from localhost ([95.168.147.255]) by smtp.gmail.com with ESMTPSA id
 jp19-20020a170906f75300b009231714b3d4sm4034655ejb.151.2023.03.16.10.38.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 16 Mar 2023 10:38:22 -0700 (PDT)
From: Sergey Trofimov <sarg@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH] image: Prefer gpt partition table for efi disk images
Date: Thu, 16 Mar 2023 18:31:38 +0100
Message-Id: <20230316173137.25074-1-sarg@HIDDEN>
X-Mailer: git-send-email 2.39.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Received-SPF: none client-ip=2a00:1450:4864:20::52a;
 envelope-from=sarg@HIDDEN; helo=mail-ed1-x52a.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_NONE=0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: submit
Cc: Sergey Trofimov <sarg@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 (---)

Hi guix, I got curious, what the easiest way to migrate existing guix os to a
new machine could be, and I've came to a conclusion that `guix system image`
fits this scenario perfectly. So I've tried to run `guix system image
--image-type=efi-raw --persistent --save-provenance system.scm`, but the
resulting image contained MBR style partition table. Although MBR support is a
must for an UEFI implementor, a better choice would be to use GPT style table.

* gnu/system/image.scm (efi-disk-image): Use gpt partition-table-type.
(efi32-disk-image): Use gpt partition-table-type.
* gnu/tests/image.scm: Assert partition table type of efi-disk-image.
---
 gnu/system/image.scm |  2 ++
 gnu/tests/image.scm  | 23 ++++++++++++++++++-----
 2 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index afef79185f..5356ecd616 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -147,11 +147,13 @@ (define root-partition
 (define efi-disk-image
   (image-without-os
    (format 'disk-image)
+   (partition-table-type 'gpt)
    (partitions (list esp-partition root-partition))))
 
 (define efi32-disk-image
   (image-without-os
    (format 'disk-image)
+   (partition-table-type 'gpt)
    (partitions (list esp32-partition root-partition))))
 
 (define iso9660-image
diff --git a/gnu/tests/image.scm b/gnu/tests/image.scm
index 99d34b7670..be6852cae0 100644
--- a/gnu/tests/image.scm
+++ b/gnu/tests/image.scm
@@ -20,7 +20,7 @@ (define-module (gnu tests image)
   #:use-module (gnu)
   #:use-module (gnu image)
   #:use-module (gnu tests)
-  #:autoload   (gnu system image) (system-image root-offset)
+  #:autoload   (gnu system image) (system-image root-offset image-with-os efi-disk-image)
   #:use-module (gnu system uuid)
   #:use-module (gnu system vm)
   #:use-module (gnu packages guile)
@@ -153,6 +153,10 @@ (define i5
       (flags '(boot))
       (initializer dummy-initializer))))))
 
+;; A efi disk image with default partitions
+(define i6
+  (image-with-os efi-disk-image %simple-efi-os))
+
 (define (run-images-test)
   (define test
     (with-imported-modules '((srfi srfi-64)
@@ -202,10 +206,10 @@ (define d2-device
               (disk-get-primary-partition-count (disk-new d2-device)))
 
             (test-equal "test"
-                (let* ((disk (disk-new d2-device))
-                       (partitions (disk-partitions disk))
-                       (boot-partition (find normal-partition? partitions)))
-                  (partition-get-name boot-partition)))
+              (let* ((disk (disk-new d2-device))
+                     (partitions (disk-partitions disk))
+                     (boot-partition (find normal-partition? partitions)))
+                (partition-get-name boot-partition)))
 
             ;; Image i3.
             (define i3-image
@@ -259,6 +263,15 @@ (define (sector->byte sector)
                    (filter data-partition?
                            (disk-partitions (disk-new d5-device)))))
 
+            ;; Image i6.
+            (define i6-image
+              #$(system-image i6))
+            (define d6-device
+              (get-device i6-image))
+
+            (test-equal "gpt"
+              (disk-type-name (disk-probe d6-device)))
+
             (test-end)))))
 
   (gexp->derivation "images-test" test))
-- 
2.39.2





Acknowledgement sent to Sergey Trofimov <sarg@HIDDEN>:
New bug report received and forwarded. Copy sent to guix-patches@HIDDEN. Full text available.
Report forwarded to guix-patches@HIDDEN:
bug#62223; 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, 22 Mar 2023 13:00:02 UTC

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