hardMultiple Choice
Boot Previous Kernel — GRUB Advanced Options
After a kernel upgrade, the system fails to boot. Which file should be edited to configure GRUB2 to boot into the previous kernel version by default?
⚠ Common exam trap
Many candidates confuse the manually editable configuration file (/etc/default/grub) with the generated boot file (/boot/grub2/grub.cfg), leading them to incorrectly edit the latter directly.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
/etc/default/grub
/etc/default/grub, because this file contains the GRUB2 configuration variables (such as GRUB_DEFAULT) that control which kernel is booted by default. After editing this file, you must run 'grub2-mkconfig -o /boot/grub2/grub.cfg' to regenerate the boot configuration, which sets the previous kernel as the default entry.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
/etc/grub.d/40_custom
Why it's wrong here
40_custom appends user-defined menu entries; it does not set which existing kernel boots by default. It is tempting because it is a GRUB2 configuration file, and would be correct for adding a bespoke boot entry, whereas the default is set in /etc/default/grub.
- ✗
/boot/grub/grub.conf
Why it's wrong here
/boot/grub/grub.conf is the legacy GRUB Legacy configuration path; GRUB2 reads /boot/grub2/grub.cfg (or /boot/grub/grub.cfg) and sets the default via GRUB_DEFAULT in /etc/default/grub. It is tempting because grub.conf was correct on older GRUB Legacy systems, which is exactly the scenario where editing it would work.
- ✗
/boot/grub2/grub.cfg
Why it's wrong here
grub.cfg is generated by grub2-mkconfig and editing it directly is overwritten on regeneration; the default kernel is set in /etc/default/grub via GRUB_DEFAULT. Editing grub.cfg suits one-off manual boot entries, not persistent configuration changes that must survive kernel updates.
- ✓
/etc/default/grub
Why this is correct
GRUB2 reads /etc/default/grub for persistent defaults, including GRUB_DEFAULT, which selects the boot entry. Editing it to point at the previous kernel's menu entry, then running update-grub, satisfies the requirement to boot the older kernel by default after the failed upgrade.
Go deeper
Related to this question
Learn chapter
Managing Storage and File Systems
Key term
Kernel
The kernel is the core program of an operating system that manages hardware resources and provides essential services for all other software to run.
Key term
GRUB
GRUB (Grand Unified Bootloader) is a boot loader package that loads and manages the operating system startup process on Linux and other Unix-like systems.
About these practice questions
Courseiva writes every XK0-006 question from scratch — 781 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.