GRUB/EFI examples
It is well known that different motherboard manufactures implement UEFI differently. The purpose of this page is to show hardware-specific methods known to work when installing/restoring GRUB in EFI mode.
esp
denotes the mountpoint of the EFI system partition aka ESP.Apple Macs
Use bless command from within macOS to set grubx64.efi
as the default boot option. You can also boot from the macOS install disc and launch a Terminal there if you only have Linux installed. In the Terminal, create a directory and mount the EFI system partition:
# cd /Volumes # mkdir efi # mount -t msdos /dev/disk0s1 /Volumes/efi
Then run bless on grub.efi
and on the EFI system partition to set them as the default boot options.
# bless --folder=/Volumes/efi --file=/Volumes/efi/EFI/GRUB/grubx64.efi --setBoot # bless --mount=/Volumes/efi --file=/Volumes/efi/EFI/GRUB/grubx64.efi --setBoot
More info at https://help.ubuntu.com/community/UEFIBooting#Apple_Mac_EFI_systems_.28both_EFI_architecture.29.
- TODO: GRUB upstream Bazaar mactel branch http://bzr.savannah.gnu.org/lh/grub/branches/mactel/changes[dead link 2018-07-12]. No further update from grub developers.
- TODO: Experimental "bless" utility for Linux by Fedora developers - mactel-bootAUR. Requires more testing.
Asus
Z68 Family and U47 Family
# cp esp/EFI/GRUB/grubx64.efi esp/shellx64.efi
After this launch the UEFI Shell from the UEFI setup/menu (in ASUS UEFI BIOS, switch to advanced mode, press Exit in the top right corner and choose "Launch EFI shell from filesystem device"). The GRUB menu will show up and you can boot into your system. Afterwards you can use efibootmgr to setup a menu entry, for example if you have the EFI system partition on /dev/sda1
:
# efibootmgr --create --disk /dev/sda --part 1 --write-signature --loader /EFI/GRUB/grubx64.efi --label "GRUB" --verbose
If your motherboard has no such option (or even if it does), you can use UEFI shell to create a UEFI boot option for the Arch partition temporarily.
Once you boot into the UEFI shell, add a UEFI boot menu entry:
Shell> bcfg boot add 0 FS0:\EFI\GRUB\grubx64.efi "GRUB"
where FS0:
is the mapping corresponding to the EFI system partition and \EFI\GRUB\grubx64.efi
is the the from the --bootloader-id
from the grub-install
command above.
This will temporarily add a UEFI boot option for the next boot to get into Arch. Once in Arch, modprobe efivars
and confirm that efibootmgr
creates no errors (no errors meaning you successfully booted in UEFI mode). Then GRUB installation can be performed again and should successfully permanently add a boot entry in the UEFI menu.
ux32vd
There is a caveat. If the machine was booted from MBR then grub-install
(or efibootmgr) will fail to create the UEFI boot entry with the following error:
EFI variables are not supported on this system
You first need to boot the machine with EFI and then create the boot entry. This can be done the way described for Z68 Family: by copying esp/EFI/GRUB/grubx64.efi
into esp/shellx64.efi
and selecting "Launch EFI shell from filesystem device".
After successful boot it is possible to create a boot entry using grub-install or efibootmgr.
P8Z77 Family
Install GRUB and copy the modified UEFI Shell binary to ESP.
The EFI system partition should contain just two files:
/Shell.efi /EFI/GRUB/grubx64.efi
- Reboot and enter the BIOS (the
Delete
key will do this). - Using the arrow keys, move to the exit menu and drop down to the EFI shell.
- Add an entry for Arch to the menu. Below is an example, see the Unified Extensible Firmware Interface#Launching UEFI Shell article for more.
Within UEFI shell
Shell> bcfg boot dump -v Shell> bcfg boot add 1 FS0:\EFI\GRUB\grubx64.efi "GRUB" Shell> exit
- Reboot the machine and enter the BIOS.
- Navigate to the Boot section and adjust the boot order to with the "GRUB" being the one on the SSD.
- Boot to this entry and enjoy.
M5A97
Finish the standard Arch install procedures, making sure that you partition your boot hard disk as GPT.
Install GRUB and copy the modified UEFI Shell binary to ESP.
The reason that we need this shell application is that the efibootmgr
command will fail silently during grub-install
.
After this launch the UEFI Shell from the UEFI setup/menu (in ASUS UEFI BIOS, switch to advanced mode, press Exit in the top right corner and choose "Launch EFI shell from filesystem device"). The UEFI shell will show up. From here we need to add our GRUB entry to the NVRAM.
Shell> bcfg boot add 3 FS0:\EFI\GRUB\grubx64.efi "GRUB"
where FS0:
is the mapping corresponding to the EFI system partition and 3
is the zero based boot entry index.
-b
option which makes output pause after each page. map
lists recognized filesystems (fs0
, ...) and data storage devices (blk0
, ...). Run help -b
to list available commands. See Unified Extensible Firmware Interface#Important UEFI Shell commands for more information.To list the current boot entries you can run:
Shell> bcfg boot dump -v
Asrock
Z97M Pro4
This is a similar procedure to Asus Z68 Family. This was tested on a Z97M Pro4 BIOS P1.90.
# cp esp/EFI/GRUB/grubx64.efi esp/shellx64.efi
After this launch the UEFI Shell from the UEFI setup/menu (in ASROCK UEFI BIOS, goto Exit tab and choose "Launch EFI Shell From Filesystem Device"). The GRUB menu will show up and you can boot into your system. Afterwards you can use efibootmgr to setup a menu entry, for example if you have the EFI system partition on /dev/sda1
:
# efibootmgr --create --disk /dev/sda --part 1 --write-signature --loader /EFI/GRUB/grubx64.efi --label "GRUB" --verbose
Dell
PowerEdge T30
The Dell UEFI implementation needs the UEFI firmware workaround to load grub. Otherwise it will drop into a "no OS found" screen.
MSI
These MSI motherboards seem to want the EFI program to exist in a different location from where GRUB installs it. Do one of the following after following the instructions for installing GRUB:
B250M PRO-VH
# mkdir esp/EFI/BOOT # cp esp/EFI/grub/grubx64.efi esp/EFI/BOOT/shellx64.efi
B150 PC MATE / B250 PC MATE / H110I PRO / Z370 GAMING PLUS
Install GRUB to the default/fallback boot path.
HP
EliteBook 840 G1
See HP EliteBook 840 G1#UEFI Setup for details.
Intel
S5400 Family
This board can run in BIOS or in EFI mode. BIOS mode requires an MBR partitioned hard drive, EFI - a GPT hard drive. Please note that this board operates on the Intel EFI v1.10 specification, and is IA32 (32-bit) only. The normal procedure for UEFI installation can be followed, with the exception of the following changes.
- Instead of using the
grub-efi-x86_64
target,grub-efi-i386
has to be used - The
bcfg
command is not available for pre-UEFI (v2.0) firmware. Astartup.nsh
file can be used on the root of the EFI system partition containing the path to the bootloader. For example:FS0:\EFI\GRUB\grubia32.efi
has to be placed in thestartup.nsh
file on the root of the EFI system partition. - The
grub.cfg
file has to be placed in the same directory as the grub EFI binary, otherwise GRUB will not find it and enter the interactive shell.
Lenovo
K450 IdeaCentre
The EFI system partition requires the file \EFI\BOOT\BOOTx64.efi
to be present in order to boot, otherwise you will receive "Error 1962: No operating system found. Boot sequence will automatically repeat."
Install GRUB to the default/fallback boot path.
This is a workaround for what is likely a bug in the UEFI implementation.
M92p ThinkCentre
This system whitelists UEFI boot entries. It will only boot from a entry called "Red Hat Enterprise Linux". So specify the bootloader-id appropriately:
# grub-install --target=x86_64-efi --efi-directory=esp --bootloader-id="Red Hat Enterprise Linux" --recheck --debug
X270 Thinkpad
Install GRUB to the default/fallback boot path.