Configuring GRUB — /etc/default/grub and update-grub
GRUB & Multibooting
Chapter 3 · Configuring GRUB — /etc/default/grub and update-grub
grub1-2 ended with a promise: this is the actual, supported way to change GRUB's behavior — the workflow that survives every future regeneration, instead of quietly vanishing after the next kernel update.
/etc/default/grub — The Real File You Edit
A plain, shell-variable-style config file, read by grub-mkconfig whenever it builds grub.cfg. Editing this file, then regenerating, is the correct workflow — the change survives every future regeneration precisely because it's now part of grub1-2's own named source of truth, not a one-off edit to generated output.
The Common Settings
- GRUB_DEFAULT — which menu entry boots automatically: a number (
0for the first entry), orsavedcombined withGRUB_SAVEDEFAULT=trueto remember whichever entry was last manually chosen - GRUB_TIMEOUT — seconds the menu is shown before auto-booting the default;
0skips the menu entirely, useful on a single-OS system; a real number matters once multiple entries genuinely need choosing between, directly relevant oncegrub1-6/grub1-7add real dual-boot entries - GRUB_TIMEOUT_STYLE —
menu/countdown/hidden, whether the menu itself is visibly shown during that countdown - GRUB_CMDLINE_LINUX_DEFAULT / GRUB_CMDLINE_LINUX — kernel parameters appended to boot entries (
_DEFAULTexcludes recovery-mode entries, the plain version applies to every entry) —grub1-4covers what these parameters actually do; this is where they're set permanently
Applying Changes — update-grub
After editing /etc/default/grub, nothing actually changes until this runs. update-grub is Debian's own wrapper around grub-mkconfig -o /boot/grub/grub.cfg — the exact regeneration step grub1-2 described, now run deliberately instead of triggered automatically by a package update. Its output lists every kernel and operating system it found along the way — the Found linux image... lines are literally 10_linux's own work from grub1-2, made visible.
A Worked Example — Reducing the Timeout and Setting a Default
- Edit
/etc/default/grub: setGRUB_TIMEOUT=3,GRUB_DEFAULT=saved, addGRUB_SAVEDEFAULT=true - Run
sudo update-grub— confirm it reports success and lists the expected kernel(s) - Reboot — the menu now shows for 3 seconds, and whichever entry was last chosen becomes the new default going forward
The whole workflow, end to end: edit the real source file, regenerate deliberately, verify by rebooting.
Custom Menu Entries — 40_custom
grub1-2 named /etc/grub.d/'s numbered scripts as auto-generating most of grub.cfg's content. 40_custom is the one deliberate exception — a script explicitly meant to hold hand-written content, run as-is by grub-mkconfig rather than generated by scanning anything. Anything placed there survives regeneration on purpose. This is the real answer to "I genuinely need a custom menu entry" — not editing grub.cfg directly, but adding it here instead.
| Approach | Survives update-grub? | Correct for |
|---|---|---|
| Editing grub.cfg directly | No — silently overwritten | Nothing — this is the grub1-2 mistake |
| Editing /etc/default/grub + update-grub | Yes | Timeouts, defaults, kernel parameters |
| Adding to 40_custom | Yes — run as-is, not overwritten | Genuinely custom, hand-written menu entries |
grub1-6/grub1-7 are relevant) that a second operating system was correctly detected.
/etc/default/grub and then not running update-grub leaves the change genuinely correct, sitting in the right place — it just hasn't been applied yet. This is a real, distinct source of "why isn't my change working" confusion from grub1-2's own "edited the wrong file entirely" mistake — here the fix is right, it's just one step short of taking effect.
Hands-On Exercises
Write the two lines you'd add to /etc/default/grub to make GRUB remember and default to whichever entry was last manually selected, and the command needed afterward to make the change take effect.
📄 View solutionExplain why a genuinely custom menu entry should be added to 40_custom rather than typed directly into grub.cfg, referencing how grub-mkconfig treats each of the two files differently.
📄 View solutionSomeone edits GRUB_TIMEOUT in /etc/default/grub, reboots, and sees no change in the menu's timing. They're confused because "I edited the right file this time." Explain the most likely cause.
📄 View solutionChapter 3 Quick Reference
- /etc/default/grub is the real, supported file to edit — changes here survive future regeneration
- GRUB_DEFAULT (which entry boots), GRUB_TIMEOUT/_STYLE (menu duration/visibility), GRUB_CMDLINE_LINUX[_DEFAULT] (kernel parameters)
sudo update-grubregenerates grub.cfg from the edited source — nothing takes effect until this runs- 40_custom is the sanctioned place for genuinely hand-written menu entries — run as-is, never overwritten
- Editing the right file but forgetting update-grub is a distinct, common mistake from grub1-2's own wrong-file mistake
- update-grub's own output lists every detected kernel/OS — a fast way to confirm a change actually took effect