On system update, Grub throws an error regarding EFI

Hello,

I ran yay -Syu today, and while running I have noticed an error concerning grub. My system is an EFI (not BIOS) system. I have tried running the installation of grub once again from CLI to see the error better:

LC_ALL=en_US.UTF-8 pacman -S grub
warning: grub-2:2.12.r382.gee789e1a-2 is up to date – reinstalling
resolving dependencies…
looking for conflicting packages…

Packages (1) grub-2:2.12.r382.gee789e1a-2

Total Installed Size:  38.21 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? \[Y/n\] y
(1/1) checking keys in keyring                                                                                     \[--------------------------------------------------------------------\] 100%
(1/1) checking package integrity                                                                                   \[--------------------------------------------------------------------\] 100%
(1/1) loading package files                                                                                        \[--------------------------------------------------------------------\] 100%
(1/1) checking for file conflicts                                                                                  \[--------------------------------------------------------------------\] 100%
(1/1) checking available disk space                                                                                \[--------------------------------------------------------------------\] 100%
:: Processing package changes…
(1/1) reinstalling grub                                                                                            \[--------------------------------------------------------------------\] 100%
:: 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:
# install-grub
# update-grub
:: Running post-transaction hooks…
(1/3) Arming ConditionNeedsUpdate…
(2/3) Installing Grub to MBR/EFI
EFI variables are not supported on this system.
EFI variables are not supported on this system.
Grub will be installed on: EFI
Installing for x86_64-efi platform.
EFI variables are not supported on this system.
EFI variables are not supported on this system.
grub-install: error: efibootmgr failed to register the boot entry: No such file or directory.
Failed: grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=Manjaro --recheck --force
WARNING: Bootloader is not properly installed, system may not be bootable
error: command failed to execute correctly
(3/3) Updating the info directory file…

What’s going on there, and how to solve it? I am pretty sure I have missed some documentation, but I can’t find something about it.

Thanks in advance.

Try sudo install-grub

:bangbang: Tip :bangbang:

When posting terminal output, copy the output and paste it here, wrapped in three (3) backticks, before AND after the pasted text. Like this:

```
pasted text
```

Or three (3) tilde signs, like this:

~~~
pasted text
~~~

This will just cause it to be rendered like this:

Sed
sollicitudin dolor
eget nisl elit id
condimentum
arcu erat varius
cursus sem quis eros.

Instead of like this:

Sed sollicitudin dolor eget nisl elit id condimentum arcu erat varius cursus sem quis eros.

Alternatively, paste the text you wish to format as terminal output, select all pasted text, and click the </> button on the taskbar. This will indent the whole pasted section with one TAB, causing it to render the same way as described above.

Thereby increasing legibility thus making it easier for those trying to provide assistance.

For more information, please see:

As I’m a moderator on the forum, I have taken the liberty of doing this for you, this time.


:bangbang::bangbang: Additionally

If your language isn’t English, please prepend any and all terminal commands with LC_ALL=C. For example:

LC_ALL=C bluetoothctl

This will just cause the terminal output to be in English, making it easier to understand and debug.

Note that the above text is partially pre-prepared as a general introduction for new forum Users. Please take the time to to understand how it is done and encourage quality responses.

Hi, thanks for the reply.

I don’t understand what the effective difference between running a command as root and running a command as non-privileged user with sudo is, but here we go:

$ LC_ALL=C sudo install-grub
sudo: unable to allocate pty: No such device

That’s kind of even worse. Never seen this before.

Never ever update with yay -Syu because you will be full with aur packages very soon. And in a very unsupported state. Update with sudo pacman -Syu. And then yay -Sua if you have aur packages.

That said, it seems you have booted in MBR mode. Check your UEFI settings and if you find CSM mode, switch to UEFI only.

2 Likes

I will give it a try and reboot the system, hoping that it’ll come up.

It’s less a reply to you, more a general remark. Hoping is no solution and running scripts to automatically install Grub on a package update is no solution for this warning box

Update/reinstall the boot loader if a new GRUB version changes the syntax of the configuration file

Automatic installations cause more issues than waiting for the day when a syntax change breaks your installation. But the even better recommendation for all (yes even for the once who want to update Grub) is setting any Grub related package to the ignore list. This is to gain control of when you want to update, because you need to be prepared.

We saw already that even if the installation works the newly installed Grub may not boot on your device. In this case you need to restore the previous state and for this you have to be prepared (with a bootable live system on a stick and a backup of the grub package you know to work on your device).

Notice also for most users there won’t be a benefit of updating Grub. Your bootloader is not your web browser - i mean to exploit a security vulnerability in the bootloader the attacker would need physical access to your machine. This is a security vulnerability in itself - before talking about the bootloader one should probably mitigate with disk encryption but yes in this case you also want to update Grub. Still you need to be prepared for this.

Accidentially, I have installed another Linux from USB pen drive some days ago, so I have a USB pen drive handy. And yes, I know how to set up a chroot environment.

That looks very strange

This message is expected if the system is booted in BIOS mode

Be sure you boot your system in EFI mode.

If this has been installed in BIOS mode, your firmware seems to be booting in BIOS mode from MBR and that might be the reason for the error messages.

Provide output of

$ sudo fdisk -l
$ sudo blkid
$ ls /sys/firmware/efi
1 Like

While I agree with most things @jofi said, I don’t think adding any package to the Ignore list is a good idea or good advice. It’s better to be prepared by reading the update Announcements for your thread, and being ready during and after the upgrade.

Doing so would leave you in a partially-updated and unsupported state, in any case and if that happens you’re on your own.

3 Likes

Ok, the system boots fine, but nevertheless, this error needs to be fixed. Sooner or later it can bite me.

[robert@solveig ~]$ LC_ALL=C sudo fdisk -l
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: LITEON CV3-8D128
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 1D69FF7D-4D9A-4FCD-BC94-4FE45421BFF4

Device         Start       End   Sectors  Size Type
/dev/sda1         34    206847    206814  101M EFI System
/dev/sda2     206848  45238271  45031424 21.5G Linux filesystem
/dev/sda3   45238272  47286271   2048000 1000M Linux swap
/dev/sda4   47286272 146622463  99336192 47.4G Linux filesystem
/dev/sda5  146622464 250068991 103446528 49.3G Linux filesystem
[robert@solveig ~]$ LC_ALL=C sudo blkid
/dev/sda4: UUID="4fc714b2-8f1e-4669-8697-4d2a5cf6d378" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="64f7c42c-5b59-43e2-86d5-e3ac5117e5b2"
/dev/sda2: UUID="91eafab7-9744-4637-9577-fc0155925324" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="85b58bba-d414-4e67-ae5e-fa93fa0ec094"
/dev/sda5: UUID="1d46b8ec-0da1-4047-8a8a-0096fd485c2c" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="bb41d8f9-f1aa-4377-a165-849c0319d76f"
/dev/sda3: UUID="764f03c4-86f4-4321-95b2-a1288584e771" TYPE="swap" PARTUUID="bb3b5781-47c0-41e7-a7cc-e892262166e5"
/dev/sda1: UUID="50CD-CDFC" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="27cfd207-a429-42f9-b535-057e75538a67"
[robert@solveig ~]$ LC_ALL=C ls /sys/firmware/efi
ls: cannot access '/sys/firmware/efi': No such file or directory

Other than that I have just noticed also in the pre-boot firmware setup that my computer is not in UEFI mode but in Legacy mode.

Identifying whether your device uses BIOS or UEFI

Run the following in a terminal:

test -d /sys/firmware/efi && echo efi || echo bios

If the output is:

  • efi, your computer uses (u)EFI.
  • bios, your computer uses BIOS.

For more information, visit:

Note that the above text is partially pre-prepared as general instructions for new users. Please take the time to follow links given and learn more.

2 Likes

Which is what 3 people told you and the reason that nothing efi-based works, including the update of grub. Just change it back to UEfi.

4 Likes

When I switch my computer to UEFI mode (and secure boot turned off), it just says “No bootdevice found.” Also, I can hardly imagine why it should suddenly switch to Legacy mode without my intervention. So, in the meanwhile I doubt that it was ever in UEFI mode, although then it confuses me that my OS has the outstanding small partition called “EFI System” mounted on /dev/sda1.

Can someone give me a hint in which direction is should investigate? I see these options:

  • Switching to UEFI mode and make the computer find the boot device
  • Fixing the GRUB config to not complain about missing EFI variables thus switching the whole boot process to BIOS mode

I don’t mind whether my computer boots in UEFI or in Legacy mode - Grub should just not throw an error.

It isn’t Grub that throws the error but the install-grub script and seemingly the script tries an EFI installation regardless of how the bootloader was installed originally and in case it wasn’t EFI - well it fails. Anyway since you can boot in legacy you can also remove the install-grub package. I think the error shouldn’t reappear then.

I would go with EFI. Just switch to EFI mode in the EFI settings, than boot up from live usb (it also has to be in efi mode, depending on how it was created) and reinstall grub.

3 Likes

What I don’t see in your fdisk output is the small bios_grub partition needed for booting in Legacy mode on a GPT disk, so my guess is that GRUB has taken the EFI partition for this purpose thus destroying the EFI files it should have contained.

Reinstalling GRUB in EFI mode should fix that.

3 Likes

I was wondering about that too, that is a very interesting theory. I am still wondering about the 3 linux partitions. I hope those are not 3 different linuxes on one disk.

Anyways, the next steps for the OP are clear - reinstall grub in EFI mode. But first check how your live usb boots (instructions above), after changing the uefi boot mode. I think the manjaro live iso could do both and should boot in the right mode if set in the uefi, but i am not 100% sure. There are mostly problems with this from some usb-making tools - some are just better than others. Ventoy is also a very valid and simple option (and you will see right away how it is made, if in efi it will have 2 partitions, a small efi one and a big data one, you just put the iso on the bigger one)

2 Likes

The Manjaro .ISOs do, when written directly at least. I guess not with Ventoy though? I have two sticks, one Legacy and one EFI. I should experiment a bit when I have time. :wink:

1 Like