From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Jesse Gibbons <jgibbons2357@gmail.com>
Cc: 44353@debbugs.gnu.org, Mathieu Othacehe <othacehe@gnu.org>
Subject: bug#44353: guix system disk-image -t raw fails with grub-efi-bootloader
Date: Sat, 07 Nov 2020 02:09:30 -0500 [thread overview]
Message-ID: <87lffdtzh1.fsf@gmail.com> (raw)
In-Reply-To: <1e589f3b-47f8-fd53-b750-d2beff8d91f5@gmail.com> (Jesse Gibbons's message of "Sat, 31 Oct 2020 10:47:35 -0600")
[-- Attachment #1: Type: text/plain, Size: 1391 bytes --]
Hello!
Jesse Gibbons <jgibbons2357@gmail.com> writes:
> To replicate:
> cd to a git checkout of the source code, gnu/system/examples
> The hash for my current checkout is
> d7e033b9a153a9e60f52ff64f4eb355c1c3d0a6e which is also the hash for my
> current version of guix.
> guix system disk-image -t raw lightweight-desktop.tmpl
>
> lightweight-desktop.tmpl defines an operating-system that uses
> grub-efi-bootloader, and is embedded in the info pages as an example
> operating system. Since it is lightweight, it doesn't take as long to
> build as desktop.tmpl.
>
> Expected results: guix builds the raw image just fine, and that image
> can be copied to an SD card and run on a computer with an efi
> bootloader, just like the counterpart with grub-bootloader. There is
> nothing in the documentation suggesting that this should not work by
> design.
>
> Actual results: guix fails, see attached log.
>
> -Jesse
Thank you for the report!
I'm CC'ing Mathieu as he knows this part of the code much better than I
do, having overhauled the generation of disk images recently!
Below are two patches I made while investigating this. Mathieu, does
that look like a proper fix? It allows images to be generated, but I'm
unsure whether they'd be bootable (I couldn't successfully boot either
EFI or MBR GRUB-based disk images in QEMU).
Anyway, attached are the patches.
Thank you!
Maxim
[-- Attachment #2: 0001-build-image-Ensure-required-arguments-are-present.patch --]
[-- Type: text/x-patch, Size: 2406 bytes --]
From 557a938633ed55c41aed8b41a0f93b6151f00943 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Fri, 6 Nov 2020 21:37:33 -0500
Subject: [PATCH 1/2] build: image: Ensure required arguments are present.
* gnu/build/image.scm (initialize-root-partition): Validate arguments.
[system-directory, references-graph]: Change from keyword to positional
arguments.
[doc]: Add space between sentences.
* gnu/system/image.scm (system-iso9660-image): Adjust.
---
gnu/build/image.scm | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/gnu/build/image.scm b/gnu/build/image.scm
index 640a784204..053972166b 100644
--- a/gnu/build/image.scm
+++ b/gnu/build/image.scm
@@ -5,6 +5,7 @@
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -179,7 +180,7 @@ to call-with-database."
make-device-nodes
(wal-mode? #t)
#:allow-other-keys)
- "Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to
+ "Initialize the given ROOT directory. Use BOOTCFG and BOOTCFG-LOCATION to
install the bootloader configuration.
If REGISTER-CLOSURES? is true, register REFERENCES-GRAPHS in the store. If
@@ -187,6 +188,20 @@ DEDUPLICATE? is true, then also deduplicate files common to CLOSURES and the
rest of the store when registering the closures. SYSTEM-DIRECTORY is the name
of the directory of the 'system' derivation. Pass WAL-MODE? to
register-closure."
+
+ (define (validate-arguments)
+ (when bootcfg
+ (unless bootcfg-location
+ (error "Missing 'bootcfg-location' argument")))
+ (when bootloader-installer
+ (unless bootloader-package
+ (error "Missing 'bootloader-package' argument")))
+ (unless references-graphs
+ (error "Missing 'references-graphs' argument"))
+ (unless system-directory
+ (error "Missing 'system-directory' argument")))
+
+ (validate-arguments)
(populate-root-file-system system-directory root)
(populate-store references-graphs root)
--
2.28.0
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-image-Only-attempt-bootloader-installation-when-supp.patch --]
[-- Type: text/x-patch, Size: 2106 bytes --]
From c642a6984d4961256f50ca5133d1eec5ca1af4e9 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Sat, 7 Nov 2020 00:20:49 -0500
Subject: [PATCH 2/2] image: Only attempt bootloader installation when
supported.
Fixes <https://issues.guix.gnu.org/44353>.
The initialize-root-partition in (guix build image) attempts to install a
bootloader when BOOTLOADER-INSTALLER is defined. Unfortunately, it relies on
a special #f value for the second argument (device), which only the
INSTALL-GRUB procedure from (gnu bootloader grub) supports.
* gnu/system/image.scm (system-disk-image): Only pass the bootloader installer
argument when the bootloader name is 'grub. Add comment.
---
gnu/system/image.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/gnu/system/image.scm b/gnu/system/image.scm
index 4075a26552..d4932466e5 100644
--- a/gnu/system/image.scm
+++ b/gnu/system/image.scm
@@ -345,8 +345,16 @@ used in the image."
#:grub-efi #+grub-efi
#:bootloader-package
#+(bootloader-package bootloader)
+ ;; 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)
#:bootcfg #$bootcfg
#:bootcfg-location
#$(bootloader-configuration-file bootloader))
--
2.28.0
next prev parent reply other threads:[~2020-11-07 7:10 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 16:47 bug#44353: guix system disk-image -t raw fails with grub-efi-bootloader Jesse Gibbons
2020-11-07 7:09 ` Maxim Cournoyer [this message]
2020-11-07 9:08 ` Mathieu Othacehe
2020-11-07 11:26 ` Bengt Richter
2020-11-07 20:32 ` Maxim Cournoyer
2020-11-08 11:04 ` Mathieu Othacehe
2020-11-12 3:57 ` bug#44353: [PATCH version-1.2.0 v2 1/3] image: Remove conflicting user-provided EFI file system Maxim Cournoyer
2020-11-12 3:57 ` bug#44353: [PATCH version-1.2.0 v2 2/3] bootloader: grub: Skip install-grub-efi when producing a disk image Maxim Cournoyer
2020-11-12 8:42 ` Mathieu Othacehe
2020-11-17 18:29 ` Maxim Cournoyer
2020-11-12 3:57 ` bug#44353: [PATCH version-1.2.0 v2 3/3] doc: Detail which bootloader get used with disk-image or vm-image Maxim Cournoyer
2020-11-12 8:45 ` Mathieu Othacehe
2020-11-12 21:16 ` Ludovic Courtès
2020-11-12 8:39 ` bug#44353: [PATCH version-1.2.0 v2 1/3] image: Remove conflicting user-provided EFI file system Mathieu Othacehe
2020-11-17 18:37 ` Maxim Cournoyer
2020-11-12 7:09 ` bug#44353: [PATCH version-1.2.0 v2] guix: system: Add a new '--non-volatile' option for disk-image Maxim Cournoyer
2020-11-12 8:36 ` Mathieu Othacehe
2020-11-12 14:59 ` Maxim Cournoyer
2020-11-12 17:06 ` Mathieu Othacehe
2020-11-17 14:44 ` Maxim Cournoyer
2020-11-12 21:18 ` Ludovic Courtès
2020-11-16 2:48 ` Maxim Cournoyer
2020-11-15 21:45 ` Ludovic Courtès
2020-11-16 3:47 ` Maxim Cournoyer
2020-11-16 9:23 ` Mathieu Othacehe
2020-11-16 13:09 ` Ludovic Courtès
2020-11-16 13:34 ` Mathieu Othacehe
2020-11-17 20:21 ` Maxim Cournoyer
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=87lffdtzh1.fsf@gmail.com \
--to=maxim.cournoyer@gmail.com \
--cc=44353@debbugs.gnu.org \
--cc=jgibbons2357@gmail.com \
--cc=othacehe@gnu.org \
/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).