efi-less grub install fails

  • Open
  • quality assurance status badge
Details
6 participants
  • Danny Milosavljevic
  • Ludovic Courtès
  • Marius Bakke
  • Mark H Weaver
  • Ricardo Wurmus
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Ricardo Wurmus
Severity
important

Debbugs page

R
R
Ricardo Wurmus wrote on 31 Jan 2018 10:55
(address . bug-guix@gnu.org)
idjmv0t503l.fsf@bimsb-sys02.mdc-berlin.net
“guix system init” fails with a configuration file that specifies
grub-bootloader (not grub-efi-bootloader).

“grub-install” reports an error about “lib/grub/x86_64-efi/modinfo.sh”
not being available. It suggests passing “--target” or “--device”.

Our invocation of grub-install does not include a “--target” argument.
Only after I edited it to pass “--target=i386-pc” did “guix system init”
pass.

This is on an x86_64 laptop where “legacy” BIOS booting is enabled.

--
Ricardo
D
D
Danny Milosavljevic wrote on 31 Jan 2018 15:34
(name . Ricardo Wurmus)(address . ricardo.wurmus@mdc-berlin.de)(address . 30311@debbugs.gnu.org)
20180201003414.4a535dec@scratchpost.org
Hi Ricardo,

On Wed, 31 Jan 2018 19:55:58 +0100
Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> wrote:

Toggle quote (10 lines)
> “guix system init” fails with a configuration file that specifies
> grub-bootloader (not grub-efi-bootloader).
>
> “grub-install” reports an error about “lib/grub/x86_64-efi/modinfo.sh”
> not being available. It suggests passing “--target” or “--device”.
>
> Our invocation of grub-install does not include a “--target” argument.
> Only after I edited it to pass “--target=i386-pc” did “guix system init”
> pass.

Hmm, I wonder what happened here.

We've been very careful to keep grub and grub-efi separate.

The entire directory lib/grub/x86_64-efi shouldn't be available in the
"grub" package output - and I checked on master, it isn't. Good.

So that leaves automatic target selection as the culprit.

And indeed, there's a call to grub_install_get_default_x86_platform
in util/grub-install.c . And that checks for availability of
/sys/firmware/efi and if it exists, defaults to EFI.

I think it's a bug in grub to do that for a grub which doesn't have EFI
platform support. :P

We could just always pass i386-pc in install-grub for i386, but then
we lose i386-ieee1275 (which I have never heard anyone using so maybe
not so bad).

Please report a bug with grub...
L
L
Ludovic Courtès wrote on 31 Jan 2018 15:55
(name . Ricardo Wurmus)(address . ricardo.wurmus@mdc-berlin.de)
87y3kdoa6m.fsf@gnu.org
Heya,

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> skribis:

Toggle quote (12 lines)
> “guix system init” fails with a configuration file that specifies
> grub-bootloader (not grub-efi-bootloader).
>
> “grub-install” reports an error about “lib/grub/x86_64-efi/modinfo.sh”
> not being available. It suggests passing “--target” or “--device”.
>
> Our invocation of grub-install does not include a “--target” argument.
> Only after I edited it to pass “--target=i386-pc” did “guix system init”
> pass.
>
> This is on an x86_64 laptop where “legacy” BIOS booting is enabled.

To complement from what we’ve discussed on IRC:

• It’s a UEFI laptop with legacy-BIOS enabled, but UEFI still.

• AIUI the installation image boots in UEFI mode on UEFI machines, and
then ‘grub-install’ (probably via ‘efivar’ or /sys or similar)
detects that it’s UEFI, decides that the target is thus
“x86_64-efi”, and fails because it lacks the EFI files.

I can think of two possible workarounds:

1. Default to ‘grub-hybrid’. But in that case, you’d have done a UEFI
install unconditionally.

2. For ‘grub-bootloader’ (not EFI), always pass ‘--target=i386-pc’.

Danny, Marius, thoughts? :-)

Ludo’.
M
M
Marius Bakke wrote on 1 Feb 2018 04:40
(address . 30311@debbugs.gnu.org)
87inbgq3wp.fsf@fastmail.com
Danny Milosavljevic <dannym@scratchpost.org> writes:

Toggle quote (35 lines)
> Hi Ricardo,
>
> On Wed, 31 Jan 2018 19:55:58 +0100
> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> wrote:
>
>> “guix system init” fails with a configuration file that specifies
>> grub-bootloader (not grub-efi-bootloader).
>>
>> “grub-install” reports an error about “lib/grub/x86_64-efi/modinfo.sh”
>> not being available. It suggests passing “--target” or “--device”.
>>
>> Our invocation of grub-install does not include a “--target” argument.
>> Only after I edited it to pass “--target=i386-pc” did “guix system init”
>> pass.
>
> Hmm, I wonder what happened here.
>
> We've been very careful to keep grub and grub-efi separate.
>
> The entire directory lib/grub/x86_64-efi shouldn't be available in the
> "grub" package output - and I checked on master, it isn't. Good.
>
> So that leaves automatic target selection as the culprit.
>
> And indeed, there's a call to grub_install_get_default_x86_platform
> in util/grub-install.c . And that checks for availability of
> /sys/firmware/efi and if it exists, defaults to EFI.
>
> I think it's a bug in grub to do that for a grub which doesn't have EFI
> platform support. :P
>
> We could just always pass i386-pc in install-grub for i386, but then
> we lose i386-ieee1275 (which I have never heard anyone using so maybe
> not so bad).

I agree, passing --target seems like the best workaround for this GRUB
bug.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlpzCrYACgkQoqBt8qM6
VPq+8gf/Y1ibK7FQhUDxpyA9k86wEW0DQi/y7S2oe6KbqQutUWi0gNtsOGGzbv5C
qydX7PAEHKkZLAWNEKBRB2ykzzN1RbmgdCZbopEam7GFPrt/+PTr0cNB8slEv9V2
63n4BZqPjPupYYSyPaZ9hksBHINBccqX3JwwtTV+WnnD9v7W5hgqPX7xnEcFE0ZK
f/7ISzRfRh1pPD6dF0mxMBH5XULruFK/F2i6C2lIDKubbf9lrYgvx00zEoZtxNrS
1I3uoIYEPcUVY2YAnO/TPQzHHkT5OACfCWYkK+/1gs5pBBDov4UncMBab3QamPQ/
0/T1JxgenCK8hWBpyW0bLo/jcU1chA==
=ULOe
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 6 Feb 2018 08:05
control message for bug #30311
(address . control@debbugs.gnu.org)
87372e5cjg.fsf@gnu.org
severity 30311 important
R
R
Ricardo Wurmus wrote on 18 Feb 2018 03:28
Re: bug#30311: efi-less grub install fails
(name . Marius Bakke)(address . mbakke@fastmail.com)
87371yy1te.fsf@mdc-berlin.de
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (40 lines)
> Danny Milosavljevic <dannym@scratchpost.org> writes:
>
>> Hi Ricardo,
>>
>> On Wed, 31 Jan 2018 19:55:58 +0100
>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> wrote:
>>
>>> “guix system init” fails with a configuration file that specifies
>>> grub-bootloader (not grub-efi-bootloader).
>>>
>>> “grub-install” reports an error about “lib/grub/x86_64-efi/modinfo.sh”
>>> not being available. It suggests passing “--target” or “--device”.
>>>
>>> Our invocation of grub-install does not include a “--target” argument.
>>> Only after I edited it to pass “--target=i386-pc” did “guix system init”
>>> pass.
>>
>> Hmm, I wonder what happened here.
>>
>> We've been very careful to keep grub and grub-efi separate.
>>
>> The entire directory lib/grub/x86_64-efi shouldn't be available in the
>> "grub" package output - and I checked on master, it isn't. Good.
>>
>> So that leaves automatic target selection as the culprit.
>>
>> And indeed, there's a call to grub_install_get_default_x86_platform
>> in util/grub-install.c . And that checks for availability of
>> /sys/firmware/efi and if it exists, defaults to EFI.
>>
>> I think it's a bug in grub to do that for a grub which doesn't have EFI
>> platform support. :P
>>
>> We could just always pass i386-pc in install-grub for i386, but then
>> we lose i386-ieee1275 (which I have never heard anyone using so maybe
>> not so bad).
>
> I agree, passing --target seems like the best workaround for this GRUB
> bug.

Okay, I’ve added “--target=i386-pc” to the list of arguments.

Thanks for the comments.

--
Ricardo
Closed
M
M
Mark H Weaver wrote on 18 Feb 2018 08:20
(address . 30311@debbugs.gnu.org)
87tvuel15z.fsf@netris.org
reopen 30311
thanks

Hi Ricardo,

Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
Toggle quote (2 lines)
> Okay, I’ve added “--target=i386-pc” to the list of arguments.

This change breaks my mips64el-linux GuixSD system, which is supported
by GRUB, but where "--target=i386-pc" is obviously not appropriate. On
my system I need a different 'target' setting.

It would be great if we could find another solution to this issue.
GRUB's automatic target selection seems to work on most systems, since
we've been relying on it for a long time without anyone reporting
problems until this bug report.

In the rare cases where GRUB fails to detect the target, perhaps we
could provide a way to specify an explicit GRUB 'target' in the grub
configuration? What do you think?

Mark
D
D
Danny Milosavljevic wrote on 18 Feb 2018 08:49
(name . Mark H Weaver)(address . mhw@netris.org)
20180218174922.47f656a7@scratchpost.org
Hi Mark,

Toggle quote (4 lines)
> This change breaks my mips64el-linux GuixSD system, which is supported
> by GRUB, but where "--target=i386-pc" is obviously not appropriate. On
> my system I need a different 'target' setting.

A pretty safe workaround is to substitute /sys/firmware/efi by /sys/firmware/non-efi
in ./grub-core/osdep/linux/platform.c for non-efi grub.

See attachment...

Toggle quote (4 lines)
> In the rare cases where GRUB fails to detect the target, perhaps we
> could provide a way to specify an explicit GRUB 'target' in the grub
> configuration?

I still think that upstream should fix this bug. It's silly that we have to
massage grub to not select a target which grub wasn't compiled for - we
patch/configure one part of grub so another part of grub isn't confused.

It's the same package :P

Bootloader configuration is complicated enough already. In this case I'd rather
grub did the right thing automatically.
From 263b1dc0de9643094bc41f4be47b4b2317e95d7c Mon Sep 17 00:00:00 2001
From: Danny Milosavljevic <dannym@scratchpost.org>
Date: Sun, 18 Feb 2018 17:30:48 +0100
Subject: [FIXME] gnu: grub: Make sure that non-EFI grub doesn't try to use
EFI.
Tags: patch

* gnu/packages/bootloader.scm (grub)[arguments]<:phases>
[patch-/sys/firmware/efi-out]: New phase.
(grub-efi)[arguments]<:phases>[patch-/sys/firmware/efi-out]: Delete phase.

---
gnu/packages/bootloaders.scm | 6 ++++++
1 file changed, 6 insertions(+)

Toggle diff (24 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 59eb22f24..c09829e17 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -103,6 +103,11 @@
(copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
(system* "gunzip" "unifont.bdf.gz")
#t))
+ (add-after 'unpack 'patch-/sys/firmware/efi-out
+ (lambda _
+ (substitute* "grub-core/osdep/linux/platform.c"
+ (("/sys/firmware/efi") "/sys/firmware/non-efi"))
+ #t))
(add-before 'check 'disable-flaky-test
(lambda _
;; This test is unreliable. For more information, see:
@@ -177,6 +182,7 @@ menu to select one of the installed operating systems.")
`(cons "--with-platform=efi" ,flags))
((#:phases phases)
`(modify-phases ,phases
+ (delete 'patch-/sys/firmware/efi-out)
(add-after 'patch-stuff 'use-absolute-efibootmgr-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "grub-core/osdep/unix/platform.c"
M
M
Marius Bakke wrote on 19 Feb 2018 19:21
(name . Ricardo Wurmus)(address . ricardo.wurmus@mdc-berlin.de)
878tbocpm2.fsf@fastmail.com
Mark H Weaver <mhw@netris.org> writes:

Toggle quote (9 lines)
> Hi Ricardo,
>
> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>> Okay, I’ve added “--target=i386-pc” to the list of arguments.
>
> This change breaks my mips64el-linux GuixSD system, which is supported
> by GRUB, but where "--target=i386-pc" is obviously not appropriate. On
> my system I need a different 'target' setting.

Maybe we can make it conditional on EFI for now. Ricardo, are you able
to test the attached patch? I suspect we might get problems on POWER
and some ARM systems down the road, but it should at least fix this
immediate issue.

Note: I haven't tested this patch myself.
From ce5d6089aff0cf6c31260ac2bbe0aeb2803eb8a0 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Tue, 20 Feb 2018 04:02:23 +0100
Subject: [PATCH] gnu: Pass "--target" to EFI-less GRUB only when EFI variables
are present.


* gnu/bootloader/grub.scm (install-grub): Make "--target" argument
conditional on the presence of "/sys/firmware/efi".
---
gnu/bootloader/grub.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Toggle diff (21 lines)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 3b01125c7..2b8458161 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -386,8 +386,13 @@ submenu \"GNU system, old configurations...\" {~%")
;; root partition.
(setenv "GRUB_ENABLE_CRYPTODISK" "y")
- (unless (zero? (system* grub "--no-floppy" "--target=i386-pc"
+ (unless (zero? (system* grub "--no-floppy"
"--boot-directory" install-dir
+ ;; Explicitly pass target if the non-EFI
+ ;; GRUB is requested on an EFI system.
+ ;; See <https://bugs.gnu.org/30311>.
+ ,@(if (file-exists? "/sys/firmware/efi")
+ "--target=i386-pc")
device))
(error "failed to install GRUB (BIOS)")))))
--
2.16.2
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlqLlFUACgkQoqBt8qM6
VPr4tgf/USpnc+DLJxUw12BYHs8BJhh3hX7I37pcNa+w8+wm1oD7WjjpJ6MGV5vB
pp2J3l21xlvss9gkOraxtzw4UA15D2KvfyB76E2y4e6ez5QA3xr9/d0Ske0guqQd
pu2Kdr0nEP7o5uLIU3Hyzu+G3wNUZQpipMJ8Q3UxaQU6jeFiGlJo8A+Mf9mi7/U4
oKgqFQk3rBFHQNnH53cuMNLkQ/9HTlt7Wk5liUIPWalwdgq75g9eWW6/QGCYRtoK
tkVn8qy4tV6ANXTtCmLWvGG+HmVe312Uf6mB8a9m6x1DSmVK9+O4sn6pflrWgb6X
Fxh5kMabo3I1EJRv08tzkBHZRg63ow==
=ozrx
-----END PGP SIGNATURE-----

M
M
Marius Bakke wrote on 19 Feb 2018 19:46
(name . Ricardo Wurmus)(address . ricardo.wurmus@mdc-berlin.de)
87606scohd.fsf@fastmail.com
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (18 lines)
> Mark H Weaver <mhw@netris.org> writes:
>
>> Hi Ricardo,
>>
>> Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> writes:
>>> Okay, I’ve added “--target=i386-pc” to the list of arguments.
>>
>> This change breaks my mips64el-linux GuixSD system, which is supported
>> by GRUB, but where "--target=i386-pc" is obviously not appropriate. On
>> my system I need a different 'target' setting.
>
> Maybe we can make it conditional on EFI for now. Ricardo, are you able
> to test the attached patch? I suspect we might get problems on POWER
> and some ARM systems down the road, but it should at least fix this
> immediate issue.
>
> Note: I haven't tested this patch myself.

Bah, here is a fixed version that actually works (for the normal case).
From 968ccb27e40ce683ec469f3ac7973827a7e8ddf5 Mon Sep 17 00:00:00 2001
From: Marius Bakke <mbakke@fastmail.com>
Date: Tue, 20 Feb 2018 04:02:23 +0100
Subject: [PATCH] gnu: Pass "--target" to EFI-less GRUB only when EFI variables
are present.


* gnu/bootloader/grub.scm (install-grub): Make "--target" argument
conditional on the presence of "/sys/firmware/efi".
---
gnu/bootloader/grub.scm | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

Toggle diff (25 lines)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index 3b01125c7..17ded5f6d 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -386,9 +386,15 @@ submenu \"GNU system, old configurations...\" {~%")
;; root partition.
(setenv "GRUB_ENABLE_CRYPTODISK" "y")
- (unless (zero? (system* grub "--no-floppy" "--target=i386-pc"
- "--boot-directory" install-dir
- device))
+ (unless (zero? (apply system* grub
+ (list "--no-floppy"
+ "--boot-directory" install-dir
+ ;; Explicitly pass target if the non-EFI
+ ;; GRUB is requested on an EFI system.
+ ;; See <https://bugs.gnu.org/30311>.
+ #$@(if (file-exists? "/sys/firmware/efi")
+ '("--target=i386-pc"))
+ device)))
(error "failed to install GRUB (BIOS)")))))
(define install-grub-efi
--
2.16.2
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlqLmg4ACgkQoqBt8qM6
VPorfwf+I0dEVp0xpxREgpi5NA6BGVafqm35tu4lMfRuACa+GiNo/JkY7YsRSrfJ
V0KONQlRHnq2ts9kjnA4EukAvtUvXdixNX0anHbNTRHXvCYIJzbjHM54VIe/Ws3O
lI2YsshsZFcMZnNDOIYXCixLfA+1f315kwqjeOW+NG7PzIhDUeTG/CvOobVVTv+h
n92gk0Ru3c7c4asL0gAKw8LZ3BWKNObOJuTqdFE5Xl186AC5pPakiXqgDpZHTExw
F6OhgHQPX/3O5/qBqqUOrqBgwKQKXVS+qlMDj9l4tLNuMdCrywuFmWp+PVg9AGE/
nCeOjHXuPOQ3bLmcd4LE9cj9G47wfg==
=yG6e
-----END PGP SIGNATURE-----

D
D
Danny Milosavljevic wrote on 20 Feb 2018 12:54
(name . Marius Bakke)(address . mbakke@fastmail.com)
20180220215420.072269e6@scratchpost.org
Hi Marius,

hmm, if the conditional doesn't have an alternative case, doesn't that mean that the
value is unspecified? The list constructor doesn't like that...

You probably meant '()

Other than that, I agree that something like this patch is the low-risk workaround
to do.
D
D
Danny Milosavljevic wrote on 20 Feb 2018 13:00
(name . Marius Bakke)(address . mbakke@fastmail.com)
20180220220011.737ee227@scratchpost.org
Also, grub-hybrid is supposed to use efi so the workaround shouldn't be used with it...

What do you think about my direct grub patch?
R
R
Ricardo Wurmus wrote on 20 Feb 2018 13:40
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87o9kjqqzw.fsf@elephly.net
Hi Danny,

Toggle quote (7 lines)
>> This change breaks my mips64el-linux GuixSD system, which is supported
>> by GRUB, but where "--target=i386-pc" is obviously not appropriate. On
>> my system I need a different 'target' setting.
>
> A pretty safe workaround is to substitute /sys/firmware/efi by /sys/firmware/non-efi
> in ./grub-core/osdep/linux/platform.c for non-efi grub.

I don’t understand this patch. How does it work?

What is the effect of replacing /sys/firmware/efi with
/sys/firmware/non-efi?

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
D
D
Danny Milosavljevic wrote on 20 Feb 2018 13:43
(name . Ricardo Wurmus)(address . rekado@elephly.net)
20180220224317.36920bcb@scratchpost.org
Toggle quote (5 lines)
> I don’t understand this patch. How does it work?
>
> What is the effect of replacing /sys/firmware/efi with
> /sys/firmware/non-efi?

It won't find EFI since it's looking in the wrong place.

That's what we want :)
R
R
Ricardo Wurmus wrote on 20 Feb 2018 13:49
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87lgfnqqlc.fsf@elephly.net
Danny Milosavljevic <dannym@scratchpost.org> writes:

Toggle quote (9 lines)
>> I don’t understand this patch. How does it work?
>>
>> What is the effect of replacing /sys/firmware/efi with
>> /sys/firmware/non-efi?
>
> It won't find EFI since it's looking in the wrong place.
>
> That's what we want :)

So the value “/sys/firmware/non-efi” might as well be
“/does-not-exist”?

Your patch subject says “Make sure that non-EFI grub doesn't try to use
EFI”, but the problem I had was that GRUB insisted on being passed a
“--target” option. That was with a GRUB installation on a system in
legacy mode. Do you mean that this failed because GRUB erroneously
attempted an EFI installation?

I’m thoroughly confused.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
D
D
Danny Milosavljevic wrote on 20 Feb 2018 14:00
(name . Ricardo Wurmus)(address . rekado@elephly.net)
20180220230027.1884531a@scratchpost.org
Hi Ricardo,

On Tue, 20 Feb 2018 22:49:19 +0100
Ricardo Wurmus <rekado@elephly.net> wrote:

Toggle quote (3 lines)
> So the value “/sys/firmware/non-efi” might as well be
> “/does-not-exist”?

Yes.

Toggle quote (8 lines)
> Your patch subject says “Make sure that non-EFI grub doesn't try to use
> EFI”, but the problem I had was that GRUB insisted on being passed a
> “--target” option.

> That was with a GRUB installation on a system in
> legacy mode. Do you mean that this failed because GRUB erroneously
> attempted an EFI installation?

Yes, I think so.

There's a default-platform function in grub which determines the default
platform to use at runtime if you don't specify one. It one checks for
the existence of /sys/firmware/efi, and if so, returns "i386-efi" or
"x86_64-efi" (see ./grub-core/osdep/linux/platform.c).

Grub's "configure" script has the ability to select which platform you
want to compile. For the "grub" package, we choose i386, and for the
"grub-efi" package, we choose i386-efi.

The "grub-hybrid" package unions the "grub" and "grub-efi" packages,
preferring files from the "grub-efi" package. I think this
configuration is what upstream actually tests (only).

In the "grub" package we then had the situation that it was compiled
for i386 (not EFI) but THEIR OWN default-platform function specified
to use i386-efi which is some seriously strange stuff.

Do you think that this was not the cause?
M
M
Marius Bakke wrote on 22 Feb 2018 07:06
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87mv019i88.fsf@fastmail.com
Danny Milosavljevic <dannym@scratchpost.org> writes:

Toggle quote (2 lines)
> Also, grub-hybrid is supposed to use efi so the workaround shouldn't be used with it...

Right, I had forgotten about grub-hybrid. That complicates things.

Toggle quote (2 lines)
> What do you think about my direct grub patch?

That works too :-) It just felt a little "heavy-handed". I'll let
Ricardo judge which approach to take.

I do wonder if we can do better though, and maybe even fix it properly.
Ricardo: Can you post the output of `find /sys/firmware/efi -maxdepth 1`
on the affected machine? With luck, we'll find a variable that is only
present on "real" EFI.

Can you also post the contents of '/sys/firmware/efi/runtime'?
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlqO3HcACgkQoqBt8qM6
VPqSEgf/RuzsaZ8bFG4EfBDdBdPCVcPuHYr6udH50T/0jf/W7LIVj+4Twj1VU6gj
H8m7Ev4UFFXbp95rlme2NDO2xAKq03R1S4UxZyMuaDonjwJo8lfvdyiYKD3tgFIx
iTPakwHBWtvntTC63UPVHcD8/YX9V2FldN/3Ehs/a1YXn7qoCITjQ8aIDaFUtN/F
lRkB3MS4iC0EYy2cbFpW9WfBtk7UxMRIfHrgwDmNIvs4RTpL1ijnXGl0HMxCqZ30
b+6/Jwb6LiJsU5pb1Y3svqGQztyJ3C4dj7Mp9/VfKEa2GXZyTAf/Pl6Rj2CWekSu
VqrBEdxAndpgkymjL0jmnHTeyVtjyg==
=dbJA
-----END PGP SIGNATURE-----

R
R
Ricardo Wurmus wrote on 22 Feb 2018 07:47
(name . Marius Bakke)(address . mbakke@fastmail.com)
871shdqb5q.fsf@elephly.net
Marius Bakke <mbakke@fastmail.com> writes:

Toggle quote (6 lines)
> Ricardo: Can you post the output of `find /sys/firmware/efi -maxdepth 1`
> on the affected machine? With luck, we'll find a variable that is only
> present on "real" EFI.
>
> Can you also post the contents of '/sys/firmware/efi/runtime'?

Now that I have GuixSD installed on that machine I don’t have
/sys/firmware/efi at all. /sys/firmware contains “acpi”, “dmi”, and
“memmap” only.

The problem occurred when I tried to install GuixSD (after booting from
a GuixSD installer USB drive), not when reconfiguring. I don’t have a
USB drive with me at the moment, so I cannot check the contents of
/sys/firmware in the installer GuixSD now.

--
Ricardo

GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
M
M
Marius Bakke wrote on 23 Feb 2018 03:30
(name . Ricardo Wurmus)(address . rekado@elephly.net)
87bmgg9c47.fsf@fastmail.com
Ricardo Wurmus <rekado@elephly.net> writes:

Toggle quote (17 lines)
> Marius Bakke <mbakke@fastmail.com> writes:
>
>> Ricardo: Can you post the output of `find /sys/firmware/efi -maxdepth 1`
>> on the affected machine? With luck, we'll find a variable that is only
>> present on "real" EFI.
>>
>> Can you also post the contents of '/sys/firmware/efi/runtime'?
>
> Now that I have GuixSD installed on that machine I don’t have
> /sys/firmware/efi at all. /sys/firmware contains “acpi”, “dmi”, and
> “memmap” only.
>
> The problem occurred when I tried to install GuixSD (after booting from
> a GuixSD installer USB drive), not when reconfiguring. I don’t have a
> USB drive with me at the moment, so I cannot check the contents of
> /sys/firmware in the installer GuixSD now.

In this case I'm certain that the installer booted in EFI mode, crushing
my dreams of a proper fix. So we'll need one of the proposed
workarounds to prevent this problem in the future.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCgAdFiEEu7At3yzq9qgNHeZDoqBt8qM6VPoFAlqP+2kACgkQoqBt8qM6
VPrZuAgAn3jwrKMtExGQ5WWbRIRodfH07x66GlJVN+rie9wjWRG/GL5dwrsBvEJk
sUCRNVLGx000PQF/ojF11XnmdXnJH3tmHuMOl80BQzvf0XiLM8NcHFphtUcSwSzx
G608tnaDU6f5FNMK3pOGyBrP7Z/b0eeYpFYam5VHT/kIMXOeqGQxrBG728CYEo53
5C2hVZI6vFbOUTvsga0EKNWNDJ9ZCM2RVeg4U1zDZh9xbrTqwXXnw/y3tidnnDzL
Vbq+kI/nct3BiaiCbVBA5hxXCeTnQZFS91p0iaOST04zea+g4TK+e8z5N+/H4kXH
k+i8mqboCmEHA5+vYwCLq+wlegQqkg==
=1WN8
-----END PGP SIGNATURE-----

D
D
Danny Milosavljevic wrote on 26 Mar 2018 14:15
(name . Ricardo Wurmus)(address . rekado@elephly.net)
20180326231545.32ad7d9d@scratchpost.org
Any news on how to proceed on this grub target thing?

I think the patch below is harmless enough and makes each grub package
self-consistent (the non-efi grub doesn't try to use efi, the grub-efi
tries to use efi and grub-hybrid tries to use efi, then).

Toggle quote (1 lines)
>From 263b1dc0de9643094bc41f4be47b4b2317e95d7c Mon Sep 17 00:00:00 2001
From: Danny Milosavljevic <dannym@scratchpost.org>
Date: Sun, 18 Feb 2018 17:30:48 +0100
Subject: [PATCH] gnu: grub: Make sure that non-EFI grub doesn't try to use
EFI.
Tags: patch

* gnu/packages/bootloader.scm (grub)[arguments]<:phases>
[patch-/sys/firmware/efi-out]: New phase.
(grub-efi)[arguments]<:phases>[patch-/sys/firmware/efi-out]: Delete phase.

---
gnu/packages/bootloaders.scm | 6 ++++++
1 file changed, 6 insertions(+)

Toggle diff (24 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 59eb22f24..c09829e17 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -103,6 +103,11 @@
(copy-file (assoc-ref inputs "unifont") "unifont.bdf.gz")
(system* "gunzip" "unifont.bdf.gz")
#t))
+ (add-after 'unpack 'patch-/sys/firmware/efi-out
+ (lambda _
+ (substitute* "grub-core/osdep/linux/platform.c"
+ (("/sys/firmware/efi") "/sys/firmware/non-efi"))
+ #t))
(add-before 'check 'disable-flaky-test
(lambda _
;; This test is unreliable. For more information, see:
@@ -177,6 +182,7 @@ menu to select one of the installed operating systems.")
`(cons "--with-platform=efi" ,flags))
((#:phases phases)
`(modify-phases ,phases
+ (delete 'patch-/sys/firmware/efi-out)
(add-after 'patch-stuff 'use-absolute-efibootmgr-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "grub-core/osdep/unix/platform.c"
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlq5YwEACgkQ5xo1VCww
uqX1ewgAkeorF3oQ251U2U69xZLLzukjbYwTRFSqYLYTUCZqjGV9eiNt8+jH/XwX
dO5I98hdXZR6UfxPqhBkjc8xB9f7TJxTiQaVgUDWRCDhxkAlK7LYRAK4MLxcXC/2
i0OpHuO9Gzg4eslNOh/HSlDqH88NRI+6FLKrHxYSWyGQKoCiRce1Lms2CsEf8ebj
/bGqXtpvn1kMAMxKqbe/FD2hYFE39LRh41fiDlDdzmB3LhIDPIN1Tn+9VVP5bYbP
nZ6UCNA3hMS3I1SS50yGg2EYLuCpVBnRPLdfgl8tMcybbGOOZcuqOx8qJ/rTE8tS
LmGrq7GKoVptAgcR24bl3FsoNMRBOA==
=oGOM
-----END PGP SIGNATURE-----


?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 30311@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 30311
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch