Subject: [PATCH] installer: Create bios_grub partition when it is needed.

From: Miguel Ángel Arruga Vivas <[email-masked]>
Date: Sat, 17 Oct 2020 15:09:27 +0200

Hi,

Brett Gilio <[email-masked]> writes:
> Ludovic Courtès <[email-masked]> writes:
>> Shouldn’t it create a “legacy” partition table rather than GPT since
>> we’re on an old, non-UEFI platform?
>
> That is my thinking as well, it should create a legacy MBR table.

IMHO the old format should be avoided completely when possible.  Why
should we enforce it?

I think this problem involves having a previous ESP partition on the
disk (at least identified as such by parted), because auto-partition!
currently checks that before checking if the booted system has EFI
support.  When that's the case, it doesn't create the needed bios_grub
partition that might have been removed previously.

The attached patch solves that.  What do you think?

Happy hacking,
Miguel
From a2f13b21a631398689cc5471c1910af294454e80 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20=C3=81ngel=20Arruga=20Vivas?=
 <[email-masked]>
Date: Sat, 17 Oct 2020 14:20:41 +0200
Subject: [PATCH] installer: Create bios_grub partition when it is needed.

* gnu/installer/parted.scm (auto-partition!): Only check for ESP on EFI
installations.
---
 gnu/installer/parted.scm | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index b0c73b837e..fffd5abf3b 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -911,13 +911,13 @@ exists."
 
     (let* ((start-partition
             (and (not has-extended?)
-                 (not esp-partition)
                  (if (efi-installation?)
-                     (user-partition
-                      (fs-type 'fat32)
-                      (esp? #t)
-                      (size new-esp-size)
-                      (mount-point (default-esp-mount-point)))
+                     (and (not esp-partition)
+                          (user-partition
+                           (fs-type 'fat32)
+                           (esp? #t)
+                           (size new-esp-size)
+                           (mount-point (default-esp-mount-point))))
                      (user-partition
                       (fs-type 'ext4)
                       (bootable? #t)
-- 
2.28.0