Which file is the configuration file that GRUB 2 generates, and which administrators are told not to edit by hand on a typical Linux distribution?
LPIC-1 Exam 101-500, objective 102. Linux installation and package management easy
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
The options
Correct /boot/grub/grub.cfg
Correct. GRUB 2 writes this file from the settings in /etc/default/grub and the scripts in /etc/grub.d/, and overwrites it on the next regeneration, which is why hand edits do not survive.
Not correct /boot/grub/menu.lst
Wrong for GRUB 2. menu.lst is the GRUB Legacy (GRUB 0.97) menu file, and that one was edited by hand.
Not correct /etc/default/grub
Wrong. This is an input, not the output: it holds shell-style variables such as GRUB_TIMEOUT and GRUB_CMDLINE_LINUX and you are expected to edit it.
Not correct /etc/grub.d/40_custom
Wrong, though also an input. This is the script where you add your own menu entries; its contents get copied into grub.cfg when the configuration is regenerated.
Why
GRUB 2 splits configuration into editable inputs and a generated output. You edit /etc/default/grub and the scripts under /etc/grub.d/, then regenerate /boot/grub/grub.cfg. GRUB Legacy had no generation step: /boot/grub/menu.lst (sometimes reachable as grub.conf) was the hand-maintained file.
Where this comes from
- Cited
- LPI exam objective 102.2
- What it says
- GRUB 2 configuration is generated into grub.cfg from /etc/default/grub and /etc/grub.d.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 102 and space the ones you get wrong.