Kernel and Boot Management: GRUB 2, Kernel Modules, and Boot Troubleshooting
This domain covers the boot chain on Oracle Linux: GRUB 2 configuration and how to change it persistently, kernel module loading, UEK versus RHCK kernels, and recovering a system that will not boot.
GRUB 2
- BIOS systems read
/boot/grub2/grub.cfg; UEFI systems read/boot/efi/EFI/oracle/grub.cfg. Never editgrub.cfgdirectly - regenerate it withgrub2-mkconfig -o /boot/grub2/grub.cfg. - Persistent kernel arguments live in
/etc/default/grubasGRUB_CMDLINE_LINUX. grubbyis the safer interface:grubby --default-kernel,grubby --info=ALL,grubby --update-kernel=ALL --args="transparent_hugepage=never",grubby --update-kernel=ALL --remove-args="...".GRUB_DEFAULT=savedplusgrub2-set-default 0andgrub2-editenv listcontrol the default entry.
Kernel modules
lsmod,modinfo <mod>,modprobe <mod>,modprobe -r,depmod -a.- Persistent load at boot: a file in
/etc/modules-load.d/; options and blacklists in/etc/modprobe.d/*.conf(blacklist floppy,options ...). - Rebuild the initramfs with
dracut -fafter storage or driver changes.
Boot troubleshooting
- Boot the entry, press
e, and addrd.breakfor an initramfs shell; orinit=/bin/bash. Addsystemctl.unit=emergency.targetfor the emergency target. - Classic root password recovery: at
rd.break,mount -o remount,rw /sysroot,chroot /sysroot,passwd root,touch /.autorelabel,exittwice.
Worked example
A database host must disable transparent huge pages permanently. Run grubby --update-kernel=ALL --args="transparent_hugepage=never", reboot, and verify with cat /proc/cmdline. Reasoning: grubby rewrites the BLS/GRUB entries for all installed kernels, so a later kernel update does not lose the setting, unlike a one-off edit at the boot menu.
Traps
- Editing
/boot/grub2/grub.cfgis lost at the next kernel update orgrub2-mkconfig. - Editing
/etc/default/grubwithout re-runninggrub2-mkconfigchanges nothing. - After changing the root password via chroot, skipping
touch /.autorelabelcauses SELinux login failures. grub2-set-defaultonly works whenGRUB_DEFAULT=saved.