Return to efi setup from grub commandline

Super User Asked by AnnoyinC on December 5, 2020

EFI allows you to return to the EFI shell/setup when exiting a bootloader, thus it should be possible with grub(2), but I can’t figure it out. What commands do you need to run?

Of course you can run reboot but it’s not as elegant.

One Answer

"EFI Shell" is a different thing from the firmware setup screen. It refers to a MS-DOS-like interactive command line shell that runs within the EFI environment.

The EFI Shell works similarly to interactive shells on Linux/BSD. It is not the default starting point; it is just a normal .efi program that's launched on demand.

If you start GRUB or another .efi program from the EFI Shell, then exiting that program will return you back to the Shell. For GRUB2, there seems to be an undocumented exit command which does that. (If it doesn't work, you might have to use normal_exit followed by exit.)

But if you didn't run GRUB that way, then the only way to enter the EFI Shell is to start the Shell's own .efi executable (e.g. shellx64.efi). I'm not quite sure about GRUB2 but I think chainload can be used here.

(When GRUB is started through the normal boot process, exiting it will simply cause the next EFI boot entry to be attempted, according to your BootOrder configuration. At best, you will only reach the firmware setup screen when all EFI boot entries fail, including the built-in ones.)

As for returning to the setup interface, I don't know of a direct way, but there is an indirect way: set the OsIndications EFI variable, then reboot. During the next boot, the firmware will skip the usual boot entries and go straight into the setup screen.

In GRUB this can be done using the fwsetup command. It can also be done from Linux using systemctl reboot --firmware, and from Windows using shutdown /fw /r /t 0.

Note that OsIndications is a later addition to UEFI, and old firmwares might not support it.

Correct answer by user1686 on December 5, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP