This control script resides in /etc/default/grub
file. It is responsible for instructing grub-mkconfig
to generate an automated grub.cfg
with main configurations, default menuentry
etc. Here, we review all the main control configurations based on grub specification:
/etc/default/grub
is a POSIX compliant shell script.
This variable is responsible for setting the grub input. It can be multiple inputs like from terminal, keyboard, serial, etc., separated by spaces. This is an optional flag.
Here are a few examples:
# take input from both console and serial ports
GRUB_TERMINAL_INPUT="console serial"
# take input from USB Keyboard
GRUB_TERMINAL_INPUT="usb_keyboard"
# take input from PC AT Keyboard
GRUB_TERMINAL_INPUT="at_keyboard"
# take input from specific serial port
GRUB_TERMINAL_INPUT="serial_ttyS1"
The default is:
GRUB_TERMINAL_INPUT="console"
This variable is responsible for setting the grub output. It can be multiple outputs like to terminal, serial port, Morse codes, etc, separated by spaces. This is an optional flag.
Here are a few examples:
# send to both console and serial ports
GRUB_TERMINAL_OUTPUT="console serial"
# send to specific serial port
GRUB_TERMINAL_OUTPUT="serial_ttyS1"
# send to gfxterm
GRUB_TERMINAL_OUTPUT="gfxterm"
# set to VGA and MGA text
GRUB_TERMINAL_OUTPUT="vga_text mga_text"
# send to Morse code
GRUB_TERMINAL_OUTPUT="morse"
# send to Speaker Modem (special compilation required for receiver side)
GRUB_TERMINAL_OUTPUT="spkmodem"
The default is:
GRUB_TERMINAL_INPUT="console"
spkmodem
, on receiver side, you need to compile util/spkmodem-recv.c
and then execute it with the following command:parecord --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv
Similar to both GRUB_TERMINAL_INPUT
and GRUB_TERMINAL_OUTPUT
. The only difference is that GRUB_TERMINAL sets both of them to be the same instead of setting them independently.
Sets the default selected menuentry
option for boot. By the newly acceptable input specification, the sensible values would be: either numbers or the keyword: saved
. The use of "id
" by "title
" is considered obsolete and is discouraged for usage.
The default value is: 0
, the first menuentry
.
saved
', then the it boots based on last saved value done by GRUB_SAVEDEFAULT
or grub-set-default
function. Set to either true
or false
. This instructs GRUB to remember the last selection for the next boot. It only works when:
GRUB_DEFAULT
is set to 'saved
'.Set waiting time before boot. This is useful for interrupting the automation for manual interaction. It accepts numbers as its value, with notable effect as the following:
-1
means wait indefinitely for user input0
means boot immediately1
and above means wait for 1 and above secondsGRUB_TIMEOUT_STYLE
is set to countdown
or hidden
, the counting starts right before the menu is presented.Set to display timeout style. There are 3 types:
menu
or unset - full menu with countdown timercountdown
- single numerical line showing the remaining timerhidden
- hide everythingThe default is unset, which shows the full menu with countdown timer.
Hardware buttons supported by vendor-specific power buttons. Nothing much you can do.
Set title name by the grub distributor.
The command lines for the kernel booting for different operating system types. It follows this pattern:
GRUB_CMDLINE_<OS>_<ADDITION>
ADDITION
. Example, GRUB_CMDLINE_LINUX
, GRUB_CMDLINE_XEN
, etc.DEFAULT
additions are the extra arguments appends to the main command line. This is meant for recovery boot cases when the boot using the main command line fails.LINUX_XEN_REPLACE
operating system simply means the arguments usable for both LINUX
and XEN
. They will replace both LINUX
and XEN
command lines if exists.This is to enable/disable the use of UUID, which is a very accurate partition identification mechanism. Universally-unique identifiers (UUIDs) is for identifying the root filesystem to the Linux kernel, using a ‘root=UUID=...
’ kernel parameter.
It only accepts:
true
- to disable Linux UUID mechanismfalse
, unset - to enable Linux UUID mechanismBy default, it is unset.
This is to enable/disable recovery menuentry
. It only accepts:
menuentry
generationmenuentry
generationThese are GRUB multimedia / video variables using gfxterm
terminal.
Usually automated once GRUB_GFXPAYLOAD_LINUX
is set. This is responsible for loading video drivers required for the GFX loading. The values are usually listed in /boot/grub/video.lst
.
Set the display resolution. It has 2 types of values:
auto
- determine automatically<width>x<height>x<depth>
OR <width>x<height>
- specifically load the resolution at <width> and <height>, optionally with <depth> as specified in GFX Mode specifications.Set GRUB background to load image. It's the filepath to the image. The filepath must ends with the extension like .png
, .jpg
, .jpeg
, and .tga
. Currently, GRUB supports the following format:
Name of the GRUB theme to use.
Configure GRUB to load in a specified display modes. It takes the following values:
text
, unset - GRUB will boot using text mode.keep
- preserves the graphic mode.Play a tune upon GRUB starts. The value is using the MIDI tempo tune specified in the play specification.
Perform bad RAM filtering (usually caused by hardware damage), following the specification. It accepts value as:
true
- run badram
commandfalse
, unset - avoid badram
commandThe default is unset.
Load the listed modules as early as GRUB starts. Each modules is separated by spaces. Example:
grub> GRUB_PRELOAD_MODULES="cryptodisk ext4"
That's all about main configuration variables controlling the grub-mkconfig
.