From: Mathieu Othacehe <othacehe@gnu.org>
To: "pelzflorian (Florian Pelz)" <pelzflorian@pelzflorian.de>
Cc: 47889@debbugs.gnu.org
Subject: bug#47889: [installer image] grub-install efi fails getting canonical path to /boot/efi on dos-formatted disk
Date: Sun, 25 Apr 2021 19:12:39 +0200 [thread overview]
Message-ID: <878s56uw3c.fsf@gnu.org> (raw)
In-Reply-To: <20210425163412.duj4t4ind5r5tv4x@pelzflorian.localdomain> (pelzflorian@pelzflorian.de's message of "Sun, 25 Apr 2021 18:34:12 +0200")
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
Hello Florian,
> Can you force GPT also in 2.? All disk partitions get removed anyway.
> Arch wiki says MSDOS layout does not work on all EFI systems
> <https://wiki.archlinux.org/index.php/EFI_system_partition#Create_the_partition>.
Well I'm not sure, if someone has an MSDOS partition table with an ESP
partition it wouldn't be a good idea to wipe it.
The attached patch forces GPT if there's no partition table, and will
preserve/create an ESP partition on an MSDOS/EFI setup. I'm testing it
on various machines, seems to work fine.
WDYT?
Thanks,
Mathieu
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-wip-esp.patch --]
[-- Type: text/x-patch, Size: 4386 bytes --]
From 65339286fe9d0c4758c04cfcaa177334577741cc Mon Sep 17 00:00:00 2001
From: Mathieu Othacehe <othacehe@gnu.org>
Date: Sun, 25 Apr 2021 19:06:31 +0200
Subject: [PATCH] wip esp
---
gnu/installer/newt/partition.scm | 16 +++++++-----
gnu/installer/parted.scm | 45 ++++++++++++++------------------
2 files changed, 28 insertions(+), 33 deletions(-)
diff --git a/gnu/installer/newt/partition.scm b/gnu/installer/newt/partition.scm
index 81cf68d782..2dcb10bbdb 100644
--- a/gnu/installer/newt/partition.scm
+++ b/gnu/installer/newt/partition.scm
@@ -95,14 +95,16 @@ DEVICES list."
(define (run-label-page button-text button-callback)
"Run a page asking the user to select a partition table label."
- (run-listbox-selection-page
- #:info-text (G_ "Select a new partition table type. \
+ (if (efi-installation?)
+ "gpt"
+ (run-listbox-selection-page
+ #:info-text (G_ "Select a new partition table type. \
Be careful, all data on the disk will be lost.")
- #:title (G_ "Partition table")
- #:listbox-items '("msdos" "gpt")
- #:listbox-item->text identity
- #:button-text button-text
- #:button-callback-procedure button-callback))
+ #:title (G_ "Partition table")
+ #:listbox-items '("msdos" "gpt")
+ #:listbox-item->text identity
+ #:button-text button-text
+ #:button-callback-procedure button-callback)))
(define (run-type-page partition)
"Run a page asking the user to select a partition type."
diff --git a/gnu/installer/parted.scm b/gnu/installer/parted.scm
index 9ef263d1f9..6d6e500d71 100644
--- a/gnu/installer/parted.scm
+++ b/gnu/installer/parted.scm
@@ -70,6 +70,7 @@
small-freespace-partition?
esp-partition?
boot-partition?
+ efi-installation?
default-esp-mount-point
with-delay-device-in-use?
@@ -193,12 +194,8 @@ inferior to MAX-SIZE, #f otherwise."
(define (esp-partition? partition)
"Return #t if partition has the ESP flag, return #f otherwise."
(let* ((disk (partition-disk partition))
- (disk-type (disk-disk-type disk))
- (has-extended? (disk-type-check-feature
- disk-type
- DISK-TYPE-FEATURE-EXTENDED)))
+ (disk-type (disk-disk-type disk)))
(and (data-partition? partition)
- (not has-extended?)
(partition-is-flag-available? partition PARTITION-FLAG-ESP)
(partition-get-flag partition PARTITION-FLAG-ESP))))
@@ -918,30 +915,26 @@ exists."
;; disk space. Otherwise, set the swap size to 5% of the disk space.
(swap-size (min default-swap-size five-percent-disk)))
- (if has-extended?
- ;; msdos - remove everything.
- (disk-remove-all-partitions disk)
- ;; gpt - remove everything but esp if it exists.
- (for-each
- (lambda (partition)
- (and (data-partition? partition)
- (disk-remove-partition* disk partition)))
- non-boot-partitions))
+ ;; Remove everything but esp if it exists.
+ (for-each
+ (lambda (partition)
+ (and (data-partition? partition)
+ (disk-remove-partition* disk partition)))
+ non-boot-partitions)
(let* ((start-partition
- (and (not has-extended?)
- (if (efi-installation?)
- (and (not esp-partition)
- (user-partition
- (fs-type 'fat32)
- (esp? #t)
- (size new-esp-size)
- (mount-point (default-esp-mount-point))))
+ (if (efi-installation?)
+ (and (not esp-partition)
(user-partition
- (fs-type 'ext4)
- (bootable? #t)
- (bios-grub? #t)
- (size bios-grub-size)))))
+ (fs-type 'fat32)
+ (esp? #t)
+ (size new-esp-size)
+ (mount-point (default-esp-mount-point))))
+ (user-partition
+ (fs-type 'ext4)
+ (bootable? #t)
+ (bios-grub? #t)
+ (size bios-grub-size))))
(new-partitions
(cond
((or (eq? scheme 'entire-root)
--
2.31.1
next prev parent reply other threads:[~2021-04-25 17:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-19 9:29 bug#47889: [installer image] grub-install efi fails getting canonical path to /boot/efi on dos-formatted disk pelzflorian (Florian Pelz)
2021-04-19 11:01 ` pelzflorian (Florian Pelz)
2021-04-19 17:27 ` Leo Famulari
2021-04-19 20:19 ` pelzflorian (Florian Pelz)
2021-04-22 13:28 ` Ludovic Courtès
2021-04-22 14:38 ` pelzflorian (Florian Pelz)
2021-04-23 10:39 ` Ludovic Courtès
2021-04-23 11:12 ` pelzflorian (Florian Pelz)
2021-04-24 3:24 ` Bengt Richter
2021-04-24 9:31 ` pelzflorian (Florian Pelz)
2021-04-25 14:15 ` Mathieu Othacehe
2021-04-25 16:34 ` pelzflorian (Florian Pelz)
2021-04-25 17:12 ` Mathieu Othacehe [this message]
2021-04-26 11:17 ` pelzflorian (Florian Pelz)
2021-04-26 15:53 ` Ludovic Courtès
2021-04-26 16:37 ` Mathieu Othacehe
2021-04-27 16:48 ` Mathieu Othacehe
2021-04-28 13:54 ` Mathieu Othacehe
2021-04-29 7:45 ` Ludovic Courtès
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=878s56uw3c.fsf@gnu.org \
--to=othacehe@gnu.org \
--cc=47889@debbugs.gnu.org \
--cc=pelzflorian@pelzflorian.de \
/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).