55

I am attempting to install Arch linux to a new (and very crappy) HP Pavillion 15 Notebook.

This is a UEFI-based machine. After several swings at it, I have managed to get pretty far. Legacy mode is disabled in the system setup, and I have EFI-booted to the Arch DVD I burned, and progressed through both the Arch Beginner's Guide and the more advanced Installation Guide to the point where I am installing grub.

While chrooted, I execute:

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck --debug

This emits a ton of output, including:

EFI variables are not supported on this system

The first time I got to this point, I continued with the installation, not knowing if it was an actual problem. Turns out it was, as when I rebooted the machine no bootable medium could be found and the machine refused to boot. I was able at that point to go in to the UEFI setup menu and select an EFI file to boot, and the Arch Linux would boot up.

But I am now going back and reinstalling again, trying to fix the problem above.

How can I get GRUB to install correctly?

1

8 Answers 8

47

I know, that's very old thread, but maybe will help for someone. Most guides suggest the same solution to mount virtual filesystems before chroot:

for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done

But now (maybe related to efivars/efivarfs changes) this loop skips one very special sub-mountpoint - /sys/firmware/efi/efivars and efibootmgr/grub fails.

So use this line instead:

for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do sudo mount -B $i /mnt$i; done

Actual success story: Debian with 4.9.0-5 (efivars) saved by Arch Linux live cd (picked just because can boot uefi out of the box) with 4.14.9-1-ARCH (efivarfs) just by bind-mounting /sys/firmware/efi/efivars

5
  • 2
    '/sys/firmware/efi': No such file or directory
    – ynn
    Commented Jun 9, 2020 at 10:19
  • 8
    mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars before chrooting did the trick! Thanks!
    – jkd
    Commented Oct 29, 2020 at 13:42
  • 3
    after a long search this solved it for me! thank you! Commented Dec 25, 2020 at 15:13
  • 1
    needs to be the accepted answer.
    – sjas
    Commented Mar 29, 2022 at 14:00
  • On Debian this solved it! Thanks!
    – rvdginste
    Commented Oct 2, 2022 at 10:21
43

The problem was simply that the efivarfs kernel module was not loaded.

This can be confirmed by:

sh-4.2# efivar-tester
UEFI variables are not supported on this machine.

If you are chrooted in to your new install, exit out, and then enable efivarfs:

exit
modprobe efivarfs

(efivarfs used to be efivars, so if this returns an error try modprobe efivars)

...and then chroot back in. In my case, this means:

chroot /mnt

but you should chroot the same way you did before.

Once back in, test again:

efivar-tester

This will no longer report an error, and you can install grub the same way you did before.

grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck --debug
7
  • 1
    See also rodsbooks.com/efi-bootloaders/principles.html Commented Sep 21, 2013 at 11:27
  • 8
    But what about on a system that doesn't support UEFI? How in the world do I install UEFI-capable GRUB on my USB stick to install Arch on a new UEFI computer if my working computer doesn't support UEFI? There's gotta be a way to do it!
    – trusktr
    Commented Nov 12, 2013 at 22:35
  • 10
    The efivars module has been replaced by "efivarfs" now (wiki.debian.org/UEFI#efibootmgr_and_efivar).
    – pedroapero
    Commented Oct 12, 2015 at 13:54
  • 4
    While modprobe efivarfs works, the issue described by the OP persists. maybe this answer needs an update? I'm totally running out of ideas.
    – q9f
    Commented Jul 19, 2017 at 11:37
  • 9
    Sadly modprobe efivars gives modprobe: FATAL: Module efivars not found in directory /lib/modules/4.16.3-301.fc28.x86_64 (freshly installed live usb)
    – jozxyqk
    Commented Jun 8, 2018 at 2:17
26

You will get this error if you have booted using legacy and not the UEFI method. You need to make sure to either select the UEFI boot item in the BIOS menu, or select UEFI as the default boot method.

4
  • 8
    I found that in my boot menu, there were two entries for my USB key, and I was picking the bottom one. The top one said UEFI: USB Key Gentoo. That fixed it.
    – Bluebaron
    Commented Mar 5, 2020 at 3:02
  • 3
    +1, that was the issue. On Gigabyte Aorus Master I had to press F12 and select EFI Arch to boot. Commented Apr 10, 2020 at 19:43
  • 1
    what if you need to boot legacy and only then you try to install grub efi into a second HD?
    – DrBeco
    Commented Jul 31, 2022 at 1:21
  • There are EFI emulators you can try.
    – cengique
    Commented Aug 1, 2022 at 3:07
8

Running Fedora 27, I needed to mount the efivarfs. I did this inside the chrootfs, however this still wasn't working, as the boot entry was shown with efibootmgr - but after reboot it was nether booted nor was shown once back in the live OS.

What finally worked, was using grub from the live medium, drop to the shell, and enter linuxefi /vmlinuz-<version> root=/dev/mapper/luks-<uuid> ro initrdefi /initramfs-<version>.img boot From the normal OS booted, I could run grub2-install without chroot, and that worked.

I am not sure whether this was just an issue with my BIOS, or there is still something more generally wrong, but this is what made grub2-install run without reporting any error.

# Open encrypted root partion cryptsetup luksOpen /dev/sda4 a4 mount /dev/mapper/a4 /mnt mount /dev/sda2 /mnt/boot mount -t proc proc /mnt/proc mount -t sysfs sys /mnt/sys mount -o bind /dev /mnt/dev mount -t devpts pts /mnt/dev/pts/ mount -o bind /etc/resolv.conf /mnt/etc/resolv.conf chroot /mnt # run inside the chroot: mount /dev/sda1 /boot/efi mount -t efivarfs efivarfs /sys/firmware/efi/efivars grub2-install

1
  • This is the only thing that's worked for me. Thank you so much!
    – daboross
    Commented Sep 2, 2020 at 0:23
7

After some hair pulling frustration, finally found the solution to this. In my case I have a preempt-rt kernel (5.6.19-rt11 (patched)) custom compiled and installed on my EFI system.

The issue come to find out is that the preempt-rt kernels do not have efi runtime active, hence the error.

The solution is so simple:

Add efi=runtime to your kernel parameters in /etc/default/grub configuration.

GRUB_CMDLINE_LINUX_DEFAULT="efi=runtime quiet"

Don't forget sudo update-grub2 !

1
1

The error message "efi variables not supported on this system" typically occurs when the system does not support EFI (Unified Extensible Firmware Interface) variables. EFI variables are a part of the UEFI standard and are used to store various system-related information, including boot options.

This error usually means that your system's firmware is not UEFI-based, or there might be an issue with your UEFI configuration. Here's what you can do to troubleshoot and potentially resolve this issue:

  1. Select UEFI boot device: Access your system's Boot menu during boot (usually by pressing F11 key) and select the UEFI boot device. (pic attached)
uefi boot device selected in boot menu

  2. Check UEFI Configuration: Access your system's UEFI settings during boot (usually by pressing a specific key like F2, F12, Delete, etc.) and navigate through the settings related to boot options. Make sure that your UEFI settings are configured correctly, and that the boot mode is set to UEFI if you're using a UEFI-based system.

  3. Check Secure Boot: If Secure Boot is enabled in your UEFI settings, try disabling it temporarily and see if it affects the behavior of efibootmgr.

1
  • 1
    Hi. Welcome to U&L. In context of this question the OP has specifically ruled this out by disabling legacy boot and thus forcing their system to boot with UEFI. Commented Aug 15, 2023 at 9:35
0

I was converting my BIOS/MBR system HDD to UEFI/GPT without data loss

As said, I shrunk last partition to create new EFI System partition with gParted and formatted it to FAT32:

Number  Start (sector)    End (sector)  Size       Code  Name
1            2048        40003583   19.1 GiB    8300  Linux filesystem
2       956772352       976771071   9.5 GiB     8200  Linux swap
3        40003584       893857099   407.1 GiB   8300  Linux filesystem
4       894054400       956465151   29.8 GiB    8300  Linux filesystem
5       956465152       956772351   150.0 MiB   EF00  EFI System

I mounted this Partition as:

 sudo  mount /dev/sda5  /boot/efi

But after installing GRUB I also got same error

 sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi /dev/sda

I Booted with Legacy BIOS and of course didn't have efivars, makes sense...

But after i rebooted my PC to change BOOT mode to UEFI Native, I was puzzled that my PC booted normally... like GRUB UEFI, despite error, was installed OK

I executed grub-install again and this time it went OK.

-5

You can't! Building and installing are two different things, the machine you build on must be uefi capable. If you want to use/install linux on uefi capable hardware gpt must already exist. You can build gpt/mbr on uefi but not both if your hardware uses old bios.

1
  • 2
    Please read the post more carefully. Commented Apr 28, 2016 at 22:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .