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=0 GRUB_TIMEOUT=5 GRUB_TIMEOUT_STYLE=menu GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX=""
  • GRUB_DEFAULT — which menu entry boots automatically: a number (0 for the first entry), or saved combined with GRUB_SAVEDEFAULT=true to remember whichever entry was last manually chosen
  • GRUB_TIMEOUT — seconds the menu is shown before auto-booting the default; 0 skips the menu entirely, useful on a single-OS system; a real number matters once multiple entries genuinely need choosing between, directly relevant once grub1-6/grub1-7 add real dual-boot entries
  • GRUB_TIMEOUT_STYLEmenu/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 (_DEFAULT excludes recovery-mode entries, the plain version applies to every entry) — grub1-4 covers what these parameters actually do; this is where they're set permanently

Applying Changes — update-grub

sudo 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

  1. Edit /etc/default/grub: set GRUB_TIMEOUT=3, GRUB_DEFAULT=saved, add GRUB_SAVEDEFAULT=true
  2. Run sudo update-grub — confirm it reports success and lists the expected kernel(s)
  3. 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.

ApproachSurvives update-grub?Correct for
Editing grub.cfg directlyNo — silently overwrittenNothing — this is the grub1-2 mistake
Editing /etc/default/grub + update-grubYesTimeouts, defaults, kernel parameters
Adding to 40_customYes — run as-is, not overwrittenGenuinely custom, hand-written menu entries
Always read update-grub's own output
It explicitly lists every kernel and OS entry it found during regeneration — often the fastest way to confirm a change actually took effect, or (once grub1-6/grub1-7 are relevant) that a second operating system was correctly detected.
Editing the right file but forgetting update-grub is a different mistake than editing the wrong file
Editing /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

Exercise 1

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 solution
Exercise 2

Explain 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 solution
Exercise 3

Someone 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 solution

Chapter 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-grub regenerates 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