LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

grub-mkconfig

generate GRUB bootloader configuration file

TLDR

Print configuration to stdout (dry run)
$ sudo grub-mkconfig
copy
Generate configuration and write to the default file
$ sudo grub-mkconfig -o /boot/grub/grub.cfg
copy
Generate configuration on Red Hat/Fedora systems
$ sudo grub2-mkconfig -o /boot/grub2/grub.cfg
copy
Display version
$ grub-mkconfig --version
copy

SYNOPSIS

grub-mkconfig [OPTION]

DESCRIPTION

grub-mkconfig generates a GRUB bootloader configuration file by processing system settings and detecting installed operating systems. It is typically used after kernel updates or when modifying boot parameters.The command reads settings from /etc/default/grub and executes scripts in /etc/grub.d/ to produce the final grub.cfg file.

PARAMETERS

-o, --output=FILE

Write the generated configuration to FILE instead of stdout
-h, --help
Display help message and exit
-V, --version
Display version information and exit

CONFIGURATION

/etc/default/grub

Main settings file controlling timeout, default entry, kernel parameters, and display options.
/etc/grub.d/
Directory of scripts executed during configuration generation. Custom boot entries can be added here.

CAVEATS

This command must be run as root. The generated configuration depends on scripts in /etc/grub.d/ and settings in /etc/default/grub. After making changes to GRUB settings, always run grub-mkconfig to regenerate the configuration. On Red Hat/Fedora, the command is named grub2-mkconfig and the config path is /boot/grub2/grub.cfg. On Debian/Ubuntu, update-grub is a convenient wrapper around grub-mkconfig.

HISTORY

grub-mkconfig is part of GRUB 2 (GRand Unified Bootloader), which replaced the original GRUB Legacy. It provides automatic detection of installed kernels and operating systems.

SEE ALSO

Copied to clipboard
Kai