On Debian-style GRUB 2, set variables such as the default entry and timeout.
Change generation inputs rather than editing grub.cfg directly.
Which file should be edited?
/etc/default/grub contains common variables read by grub-mkconfig. After changing it, regenerate the generated configuration using the distribution's procedure.
Detailed explanation
/etc/default/grubCorrect. This file supplies common GRUB 2 generation variables.
Correct. This file supplies common GRUB 2 generation variables.
/proc/cmdlineIncorrect. /proc/cmdline shows arguments from the current boot and is not a persistent input file.
Incorrect. /proc/cmdline shows arguments from the current boot and is not a persistent input file.
/boot/grub/grubenvIncorrect. grubenv stores selected environment values, not the main generation variables.
Incorrect. grubenv stores selected environment values, not the main generation variables.
/etc/mtabIncorrect. /etc/mtab describes current mounts.
Incorrect. /etc/mtab describes current mounts.
Try it yourself
An example you can run in a temporary verification environment.
test -r /etc/default/grub && grep -E '^GRUB_(DEFAULT|TIMEOUT)=' /etc/default/grub || echo 'GRUB defaults are unavailable'Expected result
設定済み変数、またはGRUB未導入の表示Key points
- /etc/default/grub is an input
- Regenerate after changes
- grub.cfg is a generated output
Notes
- Environment: GRUB 2 / Debian系構成
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.