unofficial mirror of help-guix@gnu.org 
 help / color / mirror / Atom feed
* EFI boot: 'could not prepare Boot variable: Invalid argument'
@ 2022-11-06 12:52 post
  2022-11-06 16:25 ` Felix Lechner via
  0 siblings, 1 reply; 5+ messages in thread
From: post @ 2022-11-06 12:52 UTC (permalink / raw)
  To: help-guix

Hi Guix-helpers,

I've just switched to a new system, but as of the 4th generation, guix 
system reconfigure fails to install the bootloader.  This is on guix 
commit 3e25944 (but that was also the case when guix system reconfigure 
still worked, I believe).  I fear my system is currently unbootable.

The error seems to come from efibootmgr, which complains about
'Could not prepare Boot variable: Invalid argument'

The failing command, if I'm not mistaken, is
/gnu/store/k1z2szmyvi1na7vzv8vnxmpb51nf4aw9-efibootmgr-17/sbin/efibootmgr 
-c -d /dev/sda -p 1 -w -L Guix -l \EFI\Guix\grubx64.efi.

and I can't find anything wrong with it.  I've also tried running the 
same command with the other version of efibootmgr I could find in 
/gnu/store, but that results in the same error.

Running efibootmgr gives me the following output:

BootCurrent: 0000
No BootOrder is set; firmware will attempt recovery
BootFFFF*

which I think implies that my system is currently unbootable?

Does anybody have a guess what can cause this (and what might solve 
it?).

many thanks!

Thomas


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EFI boot: 'could not prepare Boot variable: Invalid argument'
  2022-11-06 12:52 EFI boot: 'could not prepare Boot variable: Invalid argument' post
@ 2022-11-06 16:25 ` Felix Lechner via
  2022-11-06 21:04   ` post
  0 siblings, 1 reply; 5+ messages in thread
From: Felix Lechner via @ 2022-11-06 16:25 UTC (permalink / raw)
  To: post; +Cc: help-guix

Hi,

On Sun, Nov 6, 2022 at 4:58 AM <post@thomasdanckaert.be> wrote:
>
> 'Could not prepare Boot variable: Invalid argument'

You have not yet rebooted, have you?

What do you see with this command?

    ls /sys/firmware/efi/vars/

You can also try 'guix install efivar' and look at the output of that
tool, but please do not attempt to change any settings yourself.

> Does anybody have a guess what can cause this (and what might solve
> it?).

Diagnosing boot problems can be difficult even when sitting in front
of the equipment. I believe your system booted via the legacy boot
sector method instead of UEFI, which made the EFI variables
unavailable.

If so, the only way to fix it is to boot via EFI.

> I fear my system is currently unbootable.

In Guix, you should have old system generations available in the GRUB
menu. That is your preferred method.

You may also be able to manually link the EFI image you wish to load
via the "removable media path". A third option that I have used is to
load your kernel directly via its EFI stub. The two latter options may
require further help from this list and lots of patience. They also
carry a higher risk of failure.

Kind regards
Felix Lechner


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EFI boot: 'could not prepare Boot variable: Invalid argument'
  2022-11-06 16:25 ` Felix Lechner via
@ 2022-11-06 21:04   ` post
  2022-11-06 23:21     ` Felix Lechner via
  0 siblings, 1 reply; 5+ messages in thread
From: post @ 2022-11-06 21:04 UTC (permalink / raw)
  To: Felix Lechner; +Cc: help-guix

> On Sun, Nov 6, 2022 at 4:58 AM <post@thomasdanckaert.be> wrote:
>> 
>> 'Could not prepare Boot variable: Invalid argument'
> 
> You have not yet rebooted, have you?
> 
> What do you see with this command?
> 
>     ls /sys/firmware/efi/vars/

efivars --list produces the following output:

8be4df61-93ca-11d2-aa0d-00e098032b8c-BootCurrent
4d1ede05-38c7-4a6a-9cc6-4bcca8b38c14-FirmwareFeatures
8be4df61-93ca-11d2-aa0d-00e098032b8c-ErrOutDev
8be4df61-93ca-11d2-aa0d-00e098032b8c-LangCodes
4d1ede05-38c7-4a6a-9cc6-4bcca8b38c14-FirmwareFeaturesMask
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOut
eb704011-1402-11d3-8e77-00a0c969723b-MTC
8be4df61-93ca-11d2-aa0d-00e098032b8c-BootFFFF
8be4df61-93ca-11d2-aa0d-00e098032b8c-ConOutDev
8be4df61-93ca-11d2-aa0d-00e098032b8c-Lang
8983fd2d-113c-4e2b-8f47-0abfeb20a41a-SmmS3NvsData
af9ffd67-ec10-488a-9dfc-6cbf5ee22c2e-AcpiGlobalVariable
4dfbbaab-1392-4fde-abb8-c41cc5ad7d5d-Setup

> Diagnosing boot problems can be difficult even when sitting in front
> of the equipment. I believe your system booted via the legacy boot
> sector method instead of UEFI, which made the EFI variables
> unavailable.
> 
> If so, the only way to fix it is to boot via EFI.
> 
>> I fear my system is currently unbootable.
> 
> In Guix, you should have old system generations available in the GRUB
> menu. That is your preferred method.

My fear is that the GRUB menu will not come up, because the bootloader 
is likely broken (at least that's what happened last time I ran into 
issues with EFI boot, though that was on another machine).  Is there 
anything I can try from the still running system, or should I just try 
to reboot and see what happens?

> You may also be able to manually link the EFI image you wish to load
> via the "removable media path". A third option that I have used is to
> load your kernel directly via its EFI stub. The two latter options may
> require further help from this list and lots of patience. They also
> carry a higher risk of failure.

I don't know how I'd go about these two options, so I'd definitely like 
some help with that.  I've also read about rEFInd, which (from my 
understanding of the documentation) might be able to boot the existing 
kernel.  Not clear if that's the way to go.

Thomas


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EFI boot: 'could not prepare Boot variable: Invalid argument'
  2022-11-06 21:04   ` post
@ 2022-11-06 23:21     ` Felix Lechner via
  2022-11-07  7:58       ` post
  0 siblings, 1 reply; 5+ messages in thread
From: Felix Lechner via @ 2022-11-06 23:21 UTC (permalink / raw)
  To: post; +Cc: help-guix

Hi,

On Sun, Nov 6, 2022 at 1:04 PM <post@thomasdanckaert.be> wrote:
>
> 8be4df61-93ca-11d2-aa0d-00e098032b8c-BootCurrent

My diagnosis was wrong. Your EFI variables are accessible. How about
the output of 'efibootmgr'?

> My fear is that the GRUB menu will not come up

That's a real possibility.

> Is there
> anything I can try from the still running system

I would try to set the EFI boot order manually. It may just be one command.

Can you post the Grub configuration of the failing setup? It should
show the past (good) configurations?

> I've also read about rEFInd

I have used that program to boot into a Linux kernel via its EFI stub,
but it is my least favorite option.

Kind regards
Felix Lechner


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: EFI boot: 'could not prepare Boot variable: Invalid argument'
  2022-11-06 23:21     ` Felix Lechner via
@ 2022-11-07  7:58       ` post
  0 siblings, 0 replies; 5+ messages in thread
From: post @ 2022-11-07  7:58 UTC (permalink / raw)
  To: Felix Lechner; +Cc: help-guix

[-- Attachment #1: Type: text/plain, Size: 1334 bytes --]

On 2022-11-06 23:21, Felix Lechner wrote:
> My diagnosis was wrong. Your EFI variables are accessible. How about
> the output of 'efibootmgr'?

The hardware is a 2009 macbook, I believe can only boot through EFI (no 
BIOS compatibility mode or anything, AFAIU).  efibootmgr reports 
(ominously)

BootCurrent: 0000
No BootOrder is set; firmware will attempt recovery
BootFFFF*

I've attached the grub.cfg of the first failing generation (that is: I 
managed to boot into this generation, but now 'guix system reconfigure' 
runs into the EFI issue).

Somewhat embarrassingly, the last fully working generation is also the 
last generation with the linux-libre kernel. I don't know if you'd still 
like to help me try to restore a working system with linux-libre, or if 
that also conflicts with this list's policy on discussion of nonfree 
software.  If not, that is of course understandable, and I'll try to 
figure it out another way (or, more likely given my limited experience 
in this area, attempt a complete fresh install ;-) ).

Thomas

> Can you post the Grub configuration of the failing setup? It should
> show the past (good) configurations?
> 
>> I've also read about rEFInd
> 
> I have used that program to boot into a Linux kernel via its EFI stub,
> but it is my least favorite option.
> 
> Kind regards
> Felix Lechner

[-- Attachment #2: efi-problem-grub.cfg --]
[-- Type: text/plain, Size: 3087 bytes --]

# This file was generated from your Guix configuration.  Any changes
# will be lost upon reconfiguration.
insmod luks
insmod luks2
cryptomount -u b121e6df828d4a93a560f560a1e4ae5b
cryptomount -u 3fa6a093ac1f4f0bb1bff46454633a58

# Set 'root' to the partition that contains /gnu/store.
search --file --set /gnu/store/ri8xhzj54jvw514hh4afqv3v2dhv39mz-grub-image.png


if loadfont unicode; then
  set gfxmode=auto
  insmod all_video
  insmod gfxterm
fi

terminal_output gfxterm

insmod png
if background_image /gnu/store/ri8xhzj54jvw514hh4afqv3v2dhv39mz-grub-image.png; then
  set color_normal=light-gray/black
  set color_highlight=yellow/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi
# Localization configuration.
# search --file --set /gnu/store/72li8q26xj9x2lb98zxddqmrysy7i2jh-grub-locales/en@quot.mo
set locale_dir=/gnu/store/72li8q26xj9x2lb98zxddqmrysy7i2jh-grub-locales
set lang=en_US
insmod keylayouts
keymap /gnu/store/xqr48xacc7018g9p1g206silm3y1wpac-grub-keymap.us

set default=0
set timeout=5
menuentry "GNU with Linux 6.0.7" {
  search --file --set /gnu/store/qhcwic52bmvxdi3g68fyd46h7k1s6cx3-linux-6.0.7/bzImage
  linux /gnu/store/qhcwic52bmvxdi3g68fyd46h7k1s6cx3-linux-6.0.7/bzImage root=/dev/mapper/cryptroot gnu.system=/gnu/store/7wqrbs7sgh87pnczysxpq1fg6cp8pi3j-system gnu.load=/gnu/store/7wqrbs7sgh87pnczysxpq1fg6cp8pi3j-system/boot modprobe.blacklist=usbmouse,usbkbd quiet
  initrd /gnu/store/31jfbn7zfrd8qysrh3981lfpii6b324h-combined-initrd/initrd.img
}

submenu "GNU system, old configurations..." {
menuentry "GNU with Linux-Libre 5.19.17 (#3, 2022-11-05 15:40)" {
  search --file --set /gnu/store/z2fcr22r752g2smwhy677bqfqmr8vjk0-linux-libre-5.19.17/bzImage
  linux /gnu/store/z2fcr22r752g2smwhy677bqfqmr8vjk0-linux-libre-5.19.17/bzImage root=/dev/mapper/cryptroot gnu.system=/var/guix/profiles/system-3-link gnu.load=/var/guix/profiles/system-3-link/boot modprobe.blacklist=usbmouse,usbkbd quiet
  initrd /gnu/store/a2q0vi35ms1jjxq2gmdnycbl3avngkx9-raw-initrd/initrd.cpio.gz
}
menuentry "GNU with Linux-Libre 5.11.15 (#2, 2022-11-05 13:56)" {
  search --file --set /gnu/store/5axms2d6yqx1zqbcjn3cl015cbcaf7i1-linux-libre-5.11.15/bzImage
  linux /gnu/store/5axms2d6yqx1zqbcjn3cl015cbcaf7i1-linux-libre-5.11.15/bzImage --root=/dev/mapper/cryptroot --system=/var/guix/profiles/system-2-link --load=/var/guix/profiles/system-2-link/boot modprobe.blacklist=usbmouse,usbkbd quiet
  initrd /gnu/store/4a547gvb5i53474878rc8axg30yvrm51-raw-initrd/initrd.cpio.gz
}
menuentry "GNU with Linux-Libre 5.11.15 (#1, 2022-11-05 13:14)" {
  search --file --set /gnu/store/5axms2d6yqx1zqbcjn3cl015cbcaf7i1-linux-libre-5.11.15/bzImage
  linux /gnu/store/5axms2d6yqx1zqbcjn3cl015cbcaf7i1-linux-libre-5.11.15/bzImage --root=/dev/mapper/cryptroot --system=/var/guix/profiles/system-1-link --load=/var/guix/profiles/system-1-link/boot modprobe.blacklist=usbmouse,usbkbd quiet
  initrd /gnu/store/4a547gvb5i53474878rc8axg30yvrm51-raw-initrd/initrd.cpio.gz
}
}

if [ "${grub_platform}" == efi ]; then
  menuentry "Firmware setup" {
    fwsetup
  }
fi

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-07  7:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-06 12:52 EFI boot: 'could not prepare Boot variable: Invalid argument' post
2022-11-06 16:25 ` Felix Lechner via
2022-11-06 21:04   ` post
2022-11-06 23:21     ` Felix Lechner via
2022-11-07  7:58       ` post

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).