How to boot into the motherboard firmware (UEFI) using terminal command
Hello,
There are situations where after installing Linux people can't find a way to boot into the UEFI to change settings. This can be caused by several reasons, one more niche case I encountered is the fwupd package doing an automatic UEFI firmware update and the much newer and more feature rich UEFI had totally different keys assigned for booting into the firmware or for one time boot device selection. In other cases people might try to troubleshoot or reinstall Linux and forgot the key or key combinations to access the firmware at boot. This guide assumes
- The system can boot into the Linux distro installed on the internal drive and it at least works well enough to open the terminal.
- The PC can boot into the Linux distro installed on the internal drive and can at worst be able to use the console TTY and login into the account.
- An alternative that the system can boot at least in live mode from USB using boot selection but the user can't/does not know the motherboard firmware key, meaning some motherboards do not need to open the firmware to allow users to select a boot device, they simply display a short list of boot devices so the keys can be completely different (the case for one of my PCs) and the user knows only one, for boot device and not how to access the entire firmware.
Part A for beginners
Assuming the above, use one of the following commands to force the PC to restart and boot automatically into the UEFI firmware (note use only one command, if it works the system will restart immediately, if not try the next):
sudo systemctl reboot --firmware-setup
sudo systemctl reboot --firmware
sudo fwsetup --reboot
Part B for advanced users that know the basics about bootloaders
1.GRUB new boot entry
- Open the following file as super user with nano text editor from terminal with command
sudo nano /etc/grub.d/40_custom
- Copy paste the following new entry and afterwards Ctrl and x to exit, y to save and press Enter
menuentry "UEFI Firmware Settings" {
fwsetup
}
- Update GRUB with command (first is valid on Linux Mint, second is more universal in case the ease of use package is not included in that distro)
sudo update-grub
Alternative
sudo grub-mkconfig -o /boot/grub/grub.cfg
2.systemd-boot terminal command
sudo bootctl reboot-to-firmware
Other troubleshooting considerations, there are cases where after a failed OS install the motherboard does not detect either the internal drive or bootable media, in such situations the easiest solution is to 1.Power off the PC, hold the power button down until the system turns off, unplug from wall socket and disconnect internal drive and bootable USB. 2. Plug the PC back to the wall socket and power on and enter motherboard firmware (you will have to find the key or key combination that allows you to boot into UEFI, typically it's F1, F2, Del, or consult motherboard manual or search for said manual on manufacturer website). Once you have entered the firmware check boot priority list (it should not include the internal drive or bootable USB), do no modify anything otherwise, discard changes and exit. After the system powers on and again does not detect any bootable device, hold the power button until the system turns off. Repeat the process, unplug from wall socket, reconnect internal drive and bootable USB, power on, enter UEFI and select bootable USB as first boot device, this time it should be detected. Why do the above process? Because in most cases it resets the boot device list. If it does not work reset CMOS, the process will be detailed in the motherboard manual.