LinuxCommandLibrary

grub-install

Install GRUB on a BIOS system

TLDR

Install GRUB on a BIOS system

$ sudo grub-install [/dev/device]
copy
Install GRUB on a BIOS system with specific architecture
$ sudo grub-install --target i386-pc [/dev/device]
copy
Install GRUB on an UEFI system
$ sudo grub-install --efi-directory [/path/to/efi]
copy
Install GRUB on UEFI with architecture and bootloader ID
$ sudo grub-install --target x86_64-efi --efi-directory [/path/to/efi] --bootloader-id GRUB
copy
Install GRUB pre-loading specific modules
$ sudo grub-install --target x86_64-efi --efi-directory [/path/to/efi] --modules "part_gpt part_msdos"
copy
Display help
$ grub-install --help
copy

SYNOPSIS

grub-install [options] device

DESCRIPTION

grub-install installs the GRUB bootloader to a disk device or EFI System Partition. The installation method differs between BIOS/legacy and UEFI systems.
For BIOS systems, GRUB is installed to the Master Boot Record (MBR) or a BIOS Boot Partition on GPT disks.
For UEFI systems, GRUB is installed to the EFI System Partition (ESP). The --bootloader-id option sets the name shown in the UEFI boot menu.
After installation, run grub-mkconfig to generate the configuration file.

PARAMETERS

--target PLATFORM

Installation target: i386-pc (BIOS), x86_64-efi, i386-efi, arm-efi
--efi-directory DIR
EFI System Partition mount point
--bootloader-id ID
Boot manager identifier in EFI menu
--boot-directory DIR
Directory containing boot files (default: /boot)
--modules MODULES
Pre-load specified GRUB modules
--recheck
Delete device map and regenerate
--removable
Install to removable media path
--force
Install even if problems detected

CAVEATS

Requires root privileges. Incorrect installation can make system unbootable - have recovery media ready. UEFI installation requires the ESP to be mounted. Secure Boot may require signed GRUB binaries.

HISTORY

GRUB 2 grub-install replaced the older GRUB Legacy installation method around 2009. It supports modern features like GPT partition tables, UEFI, and modular design.

SEE ALSO

Copied to clipboard