Subject: bug#28768: guix system vm Failed to install GRUB (EFI)

From: [email-masked] (Ludovic Courtès)
Date: Thu, 12 Oct 2017 10:46:23 +0200

Marius Bakke <[email-masked]> skribis:

> Oleg Pykhalov <[email-masked]> writes:
>
>> EFI bootloader configuration causes problems to test with 'system vm'
>> before 'reconfigure'.
>
> This is because `guix system vm` is not currently UEFI enabled, so GRUB
> tries to install for a normal PC BIOS.
>
> The fix would be to make the various QEMU invocations in (gnu system vm)
> take a #:firmware parameter that passes something along the lines of
> '-bios #$(file-append ovmf "/share/ovmf/firmware/ovmf_x64.bin")' to the
> QEMU command-line, and update other scripts to take advantage.

Perhaps by adding it to <virtual-machine> records we’d make it less
annoying to pass around?  Or are there other places that would still
need extra care?

Another option, in the meantime is this:

diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 273a895be..f763b430b 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -565,6 +565,14 @@ environment with the store shared with the host.  MAPPINGS is a list of
                   user-file-systems)))
 
   (operating-system (inherit os)
+
+    ;; XXX: Until we run QEMU with UEFI support (with the OVMF firmware),
+    ;; force the traditional i386/BIOS method.
+    ;; See <https://bugs.gnu.org/28768>.
+    (bootloader (bootloader-configuration
+                  (bootloader grub-bootloader)
+                  (target "/dev/vda")))
+
     (initrd (lambda (file-systems . rest)
               (apply base-initrd file-systems
                      #:volatile-root? #t

That’s what I do manually anyway.

WDYT?  If that’s fine with you, I can commit it.

Thanks,
Ludo’.