What it does
On BIOS systems, grub2-install /dev/vda writes the GRUB boot code to the start of the disk and the modules to /boot/grub2/. On UEFI systems with Secure Boot, do not use it: reinstall the packages grub2-efi-x64 and shim-x64 instead, which put the signed files in /boot/efi/EFI/redhat/.
After installing, create the config with grub2-mkconfig -o /boot/grub2/grub.cfg.
How to write it
grub2-install [OPTION]... DEVICEOptions 20
Most used
Nothing matches this filter.
Examples 10
$ run as a normal user# run as root (or with sudo)
1Reinstall GRUB on a BIOS disk
grub2-install /dev/vda Installing for i386-pc platform. Installation finished. No error reported.The disk, not a partition.
2Then rebuild the config
grub2-mkconfig -o /boot/grub2/grub.cfgMenu entries come from BLS files.
3From a rescue disk
chroot /mnt/sysroot grub2-install /dev/vdaInside the installed system.
4Is this BIOS or UEFI?
Decides which repair to use.
5UEFI repair (instead of grub2-install)
dnf reinstall -y grub2-efi-x64 shim-x64Signed files for Secure Boot.
6UEFI boot entries
efibootmgr -vCheck that "Red Hat Enterprise Linux" points to shimx64.efi.
7Both disks of a software RAID1
grub2-install /dev/vda; grub2-install /dev/vdbThe system boots even when one disk fails.
8Verbose run
grub2-install -v /dev/vda 2>&1 | tailFind the reason of an error.
9Another boot folder
grub2-install --boot-directory=/mnt/sysroot/boot /dev/vdaWithout chroot.
10Check the boot sector
The boot code is there.
Nothing matches this filter.
Exit codes
0 | Done. |
1 | Error. |