Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems during U-boot stage: Unable to read file ubootefi.var, Failed to load EFI variables #37

Open
Maxwell-Wong opened this issue Aug 23, 2022 · 11 comments

Comments

@Maxwell-Wong
Copy link

Device: 2020 Macbook Pro M1, MacOS13, I've got the following errors:

Failed to load '/'
** Unable to read file ubootefi.var **
Failed to load EFI variables
BootOrder not defined
EF1 boot manager: Cannot load any image
Found EFI removable media binary EFI/boot/bootaa64.efi
192512 bytes read in 0 ms
Booting ref i\boot bootaa64.efi

@jannau
Copy link
Member

jannau commented Aug 23, 2022

Is there a problem? Those messages are expected because the boot option used is the last fallback. This could be avoided but that would mean we need more modifications in u-boot distro_boot environment.

@Maxwell-Wong
Copy link
Author

Is there a problem? Those messages are expected because the boot option used is the last fallback. This could be avoided but that would mean we need more modifications in u-boot distro_boot environment.

My machine stuck in this stage.
The full message is the following:

U-Boot 2022.07 (Jul 11 2022 - 17:18:25 +0000)
GNU GRUB version 2.06
Model: Apple MacBook Pro (13-inch, M1, 2020)
Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists possible device or file completions.
USB XHCI 1.10
Bus usba502280000: Register 2000478 NbrPorts 2 grub> ng the controller
USB XHCI 1.10
scanning bus usb@382280000 for deuices..
1 USB Device(s) found
scanning bus usb502280000 for deuices...
1 USB Device(s) found
scanning ush for storage devices... 0 Storage Deuice(s) found
Hit any key to stop autoboot:
Device 0: Vendor: Apple Reu: 873.0.26 Prod: Oba01086210f616
Type: Hard Disk
Capacity: 477102.0 MB = 465.9 GB (122138133 x 4096)
... is now current device
Scanning nume 0:4.
** Unable to read file /
Failed to load '/'
** Unable to read file ubootefi.var **
Failed to load EFI variables
BootOrder not defined
EFI boot manager: Cannot load any image
Found EFI removable media binary efi/boot/bootaa64.efi
192512 bytes read in 0 ms
Booting /ef i\boot bootaa64.efi

@jannau
Copy link
Member

jannau commented Aug 24, 2022

ok. From u-boot everything looks ok. It loads and starts bootaa64.efi from the ESP partition. That is grub. There is nothing on the display after this?
Do you remember if grub was updated before you saw the boot failure? There was a update last week which could run out of memory on some machines. I'm not sure if this explains this error but it seems possible.
The only problem is that the fix requires booting into the system. Do you remember which partition is your linux installation? Based on the log I suspect it is `/dev/nvme0n1p5. I'll prepare instructions to boot the system directly with u-boot tonight (CEST).

@Maxwell-Wong
Copy link
Author

Sure, there is nothing on display after this.
I just created a new partition from Macintosh HD with the instruction and installed Linux on it.
I have no solution to this and I can't find the bug by myself, so, could you please update relevant instructions toward this problem in detail?
Thanks!!

@jannau
Copy link
Member

jannau commented Aug 28, 2022

If the problem is the broken grub which was for a few days in the package repository following commands should let you start linux from u-boot. Once linux is booted an update will install a fixed grub package.

When u-boot ask you to press a key to interrupt auto boot do so. Enter the following commands. (partition numbers are based output). commands and variables (${}) tab-complete, file names do not.

setenv bootargs 'root=/dev/nvme0n1p5 rw'
nvme scan
load nvme 0:5 ${kernel_addr_r} /boot/vmlinuz-linux-asahi
load nvme 0:5 ${ramdisk_addr_r} /boot/initramfs-linux-asahi.img
booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdtcontroladdr}

@neumayer
Copy link

neumayer commented Sep 1, 2022

@jannau I'm in the same situation as the original poster. Thanks for your instructions, I can boot again now.

But it seems I'm not in efi mode and as such grub won't let me run grub-install. I'm not sure if I remember it correctly, but I might not have been in efi mode to start with (that's how I ended up in this situation, grub-install failed, I ignored/didn't read properly and rebooted after the grub update.

I'm not sure what I did to end up in this situation (and why not everyone else also ended up here). And I don't think I know how to get out of it either, so any tips are welcome :-)

@neumayer
Copy link

neumayer commented Sep 3, 2022

"update-grub" from asahi-scripts, properly upgrades grub.

But this means that mindlessly copy/pasting the "grub-install ..." output from the most recent grub update from pacman is what put me in this situation. And might put others in that situation?

In any case, I will remember that I need the update-grub script to, well, install grub. So I'm good.

@jannau
Copy link
Member

jannau commented Sep 3, 2022

does grub-install ... do anything by itself or do you have to fill in the dots yourself? grub-install works only with the --removable flag since our EFI implementation does not support EFI variables.

@neumayer
Copy link

neumayer commented Sep 3, 2022

The grub pacman package just tells you to run:

:: To use the new features provided in this GRUB update, it is recommended
   to install it to the MBR or UEFI. Due to potential configuration
   incompatibilities, it is advised to run both, installation and generation
   of configuration:
     $ grub-install ...
     $ grub-mkconfig -o /boot/grub/grub.cfg

The dots are just ignored by grub? But really that's just plain guessing on my part.

The update-grub script then sets the removable flag, enough for me to get out of this.

But any grub-install call without the removable flag would probably end up with the same failure? And if you then ignore the output "won't work with efivars" error, I think that was enough to put me into that situation. Why it's not hitting everyone, I don't know. But I think all I did was pacman update, grub-install (failing), and reboot.

@jannau
Copy link
Member

jannau commented Sep 4, 2022

grub-install fails for me with efibootmgr: not found so the default install is probably safe

@aziz76
Copy link

aziz76 commented May 29, 2023

I have run into this issue and managed to boot with the given instructions but once there and I run the grub-update scripts, the issue is not fixed. The update script runs with no errors however, when I reboot, I get the same grub error. The only difference for me is my boot partition is on /dev/nvme0n1p6.

Is there something else I am missing? Any help would be much appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants