grub-editenv
manage GRUB environment block variables
TLDR
Set a default boot entry
SYNOPSIS
grub-editenv file command
DESCRIPTION
grub-editenv manages GRUB's environment block (grubenv), which stores persistent variables across boots. The environment file is typically located at /boot/grub/grubenv or /boot/grub2/grubenv.
Common variables include saved_entry (the boot entry to use when GRUBDEFAULT=saved), **nextentry (entry for next boot only, used by grub-reboot), and recordfail** (set when a boot fails).
This tool enables scripted management of boot configuration without regenerating grub.cfg.
PARAMETERS
list
List all variables in the environment fileset NAME=VALUE
Set a variable to a valueunset NAME
Remove a variablecreate
Create a new empty environment file
CONFIGURATION
/boot/grub/grubenv
The GRUB environment block file storing persistent boot variables./etc/default/grub
Must contain GRUB_DEFAULT=saved for grub-editenv settings to take effect.
CAVEATS
The grubenv file has a fixed size (1024 bytes). Variables and values must fit within this space. Some bootloader configurations may not use grubenv. Changes require GRUB_DEFAULT=saved in /etc/default/grub.
HISTORY
grub-editenv is part of GRUB 2's saved default mechanism, allowing boot preferences to persist without modifying the main configuration file. This enables features like "boot once" and remembering the last successful boot.
SEE ALSO
grub-set-default(8), grub-reboot(8), grub-mkconfig(8)
