grub-mkrescue
Create bootable image from GRUB files
SYNOPSIS
grub-mkrescue [OPTION...] [SOURCE...]
PARAMETERS
-o, --output=FILE
Write the generated image to FILE.
-d, --directory=DIR
Use images and modules under DIR (usually /usr/lib/grub/platform).
-m, --modules=MODULES
Specify a space-separated list of GRUB modules to embed.
-c, --config-file=FILE
Embed FILE as the grub.cfg configuration.
-f, --fonts=FONTS
Embed a space-separated list of GRUB fonts.
-t, --themes=THEMES
Embed a space-separated list of GRUB themes.
--compress=no|xz|gz|lzo
Choose compression method for GRUB modules.
--locales=LOCALES
Embed a space-separated list of locales.
--sfs-path=PATH
The path to the SquashFS image containing GRUB modules.
--grub-mkimage=PATH
Path to the grub-mkimage binary to use.
--label=LABEL
Set the volume label for the ISO9660 filesystem.
--root-directory=DIR
Specifies the root directory from which to read files.
-h, --help
Display help message and exit.
--version
Print version information and exit.
DESCRIPTION
grub-mkrescue is a utility from the GRUB bootloader suite designed to create a standalone, bootable GRUB image, typically an ISO file. This image can then be burned to a CD/DVD or written to a USB drive to create a rescue disk. It's invaluable for system administrators and users facing boot issues, as it allows booting into a GRUB shell or a basic environment where they can diagnose and repair problems, such as reinstalling GRUB, correcting grub.cfg errors, or accessing filesystems. The command works by bundling essential GRUB modules, kernel images, and configuration files into a self-contained image. It intelligently determines the necessary files based on the GRUB installation or specified modules, providing a flexible recovery tool.
CAVEATS
grub-mkrescue typically requires xorriso (or mkisofs on older systems) to be installed on the system to create the final ISO image. The generated image provides a minimal GRUB environment; advanced hardware or specific filesystem support might require explicit inclusion of additional modules via the --modules option.
Creating the image often requires root privileges, especially when accessing system GRUB files.
DEPENDENCIES
grub-mkrescue relies on external utilities like xorriso (or mkisofs) to create the ISO image and internally uses grub-mkimage to build the GRUB core image. These tools must be present and accessible in the system's PATH for grub-mkrescue to function correctly.
USAGE EXAMPLE
To create a basic GRUB rescue ISO file named grub_rescue.iso:
grub-mkrescue -o grub_rescue.iso
To create a customized rescue ISO, embedding specific modules and a custom configuration file:
grub-mkrescue -o custom_rescue.iso --modules="part_gpt fat ext2 search normal configfile linux" --config-file=/path/to/custom_grub.cfg
HISTORY
GRUB (Grand Unified Bootloader) has been the de facto standard bootloader for many Linux distributions since the early 2000s. GRUB 2.0, a complete rewrite, introduced modularity and extensibility, including support for UEFI. grub-mkrescue emerged as part of the GRUB 2.0 suite, simplifying the creation of bootable rescue media, an essential tool for system recovery that was more cumbersome with GRUB Legacy. Its development is intertwined with the ongoing evolution and maintenance of the GRUB 2.0 project.
SEE ALSO
grub-mkimage(1), grub-install(8), grub-mkconfig(8), xorriso(1), mkisofs(8)