GRUB2/Config Variables

From Gentoo Wiki
< GRUB2
Jump to: navigation, search

This article provides a reference of the variables that may be set in /etc/default/grub to control the configuration file generated by grub2-mkconfig.

General

Variable Default Description
GRUB_DEFAULT 0 Default menu entry selected on boot. May be a numeric index or a menu title.
GRUB_TIMEOUT 5 Delay before booting default menu entry. Set to 0 to boot immediately or -1 to wait indefinitely.
GRUB_DEVICE (detected) Device node for the volume containing the root filesystem. Set this to override the grub2-mkconfig command's root device auto-detection. For example, GRUB_DEVICE=/dev/ram0 will force root=/dev/ram0 to be used in the kernel command line.
GRUB_DEVICE_UUID (detected) UUID of the root filesystem.
GRUB_DISABLE_RECOVERY false If true, recovery menu entries will not be generated. On Linux, recovery entries pass "single" on the kernel command-line.
GRUB_FONT (detected) Font in pf2 format used during gfxmode display. Not setting one can prevent gfxmode.

pf2 fonts can be created using the grub2-mkfont utility. For example, to create a GRUB2 fp2 font from a TTF (True Text Font) called DroidSansMonoSlash.ttf run:

root #grub2-mkfont /usr/share/fonts/droid/DroidSansMonoSlashed.ttf --size=20 --output /boot/grub/fonts/DroidSansMonoSlashed20.pcf

To use the newly created font, set the GRUB_FONT variable to the font's location.

CODE Example GRUB_FONT configuration
GRUB_FONT=/boot/grub/fonts/DroidSansMonoSlashed20.pcf

Linux

Variable Default Description
GRUB_CMDLINE_LINUX Extra parameters to be passed on the kernel command line for all Linux menu entries. For instance, to support hibernation, users will need to add GRUB_CMDLINE_LINUX="resume=/dev/sdXY" with /dev/sdXY being the swap partition.
GRUB_CMDLINE_LINUX_DEFAULT Extra parameters to be passed on the kernel command line for non-recovery Linux menu entries.
GRUB_DISABLE_LINUX_UUID false If true, ${GRUB_DEVICE} is passed in the root parameter on the kernel command line.

If false, ${GRUB_DEVICE_UUID} is passed in the root parameter on the kernel command line when an initramfs is available.

GRUB_GFXPAYLOAD_LINUX text Controls the video mode in which the Linux kernel starts. May be set to "text", "keep", or a display resolution.

Xen

Variable Default Description
GRUB_CMDLINE_XEN Extra parameters to be passed on the Xen command line for all Xen menu entries. For instance, to have a timestamped Xen dmesg, users will need to add GRUB_CMDLINE_XEN="console_timestamps=boot".
GRUB_CMDLINE_XEN_DEFAULT Extra parameters to be passed on the Xen command line for non-recovery Xen menu entries.
GRUB_CMDLINE_LINUX_XEN_REPLACE Overrides the GRUB_CMDLINE_LINUX variable from the above Linux section for Xen boot lines only.
GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT Overrides the GRUB_CMDLINE_LINUX_DEFAULT variable from the above Linux section for Xen boot lines only. Users may prefer to start a specific softlevel for xen via GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT="softlevel=xen"