GRUB/Configuration variables

From Gentoo Wiki
< GRUB
Jump to:navigation Jump to: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. The entry may be identified by number (starting from 0), title, or id. When using submenus, it is specified by menu>submenu, like 0>1, or other>minix>minix-3.4.0 (see documentation on grub default variable or this post on gentoo-forums).
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
GRUB_DISABLE_OS_PROBER true When true, the os-prober utility is bypassed meaning additional OS loaders will not be searched. Setting GRUB_DISABLE_OS_PROBER=false will have grub-mkconfig search for additional installations when os-prober is installed.
GRUB_PRELOAD_MODULES List of GRUB module names separated by spaces that will be loaded at the start of grub.cfg. This may be needed if the GRUB boot is in a LVM partition.

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_DISABLE_LINUX_PARTUUID true Since version 2.04. If false, and if there is either no initramfs or GRUB_DISABLE_LINUX_UUID is set to true, ${GRUB_DEVICE_PARTUUID} is passed in the root parameter on the kernel command line. See Root identification Heuristics.
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"