Linux grub mkconfig Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux grub-mkconfig Guide
Complete beginner-friendly guide to grub-mkconfig on Linux, covering Arch Linux, CachyOS, and other distributions including GRUB configuration generation, boot menu creation, and GRUB setup.
Table of Contents
- Understanding grub-mkconfig
- grub-mkconfig Basics
- Generating Configuration
- GRUB Configuration
- Troubleshooting
Understanding grub-mkconfig
What is grub-mkconfig?
grub-mkconfig generates GRUB configuration.
Uses:
- Generate config: Create GRUB configuration
- Boot menu: Generate boot menu
- Kernel detection: Detect installed kernels
- GRUB setup: Set up GRUB bootloader
Why it matters:
- Boot configuration: Configure boot menu
- Kernel updates: Update after kernel install
- GRUB management: Manage GRUB bootloader
grub-mkconfig Basics
Generate Config
Basic usage:
# Generate GRUB configuration
sudo grub-mkconfig -o /boot/grub/grub.cfg
# -o = output (config file)
Preview Output
Test generation:
# Preview (no write)
sudo grub-mkconfig
# Shows config without writing
Generating Configuration
Standard Location
Default output:
# Standard location
sudo grub-mkconfig -o /boot/grub/grub.cfg
# For BIOS systems
sudo grub-mkconfig -o /boot/grub/grub.cfg
# For UEFI systems
sudo grub-mkconfig -o /boot/EFI/grub/grub.cfg
After Kernel Install
Update after kernel:
# After installing new kernel
sudo grub-mkconfig -o /boot/grub/grub.cfg
# Updates boot menu
GRUB Configuration
Configuration Files
Edit config:
# Main config template
sudo vim /etc/default/grub
# Scripts in /etc/grub.d/
Custom Entries
Add entries:
# Custom entries in
sudo vim /etc/grub.d/40_custom
# Add custom boot entries
Troubleshooting
grub-mkconfig Not Found
Check installation:
# Check grub
which grub-mkconfig
# Install if missing
sudo pacman -S grub
Summary
This guide covered grub-mkconfig usage, GRUB configuration generation, and boot menu creation for Arch Linux, CachyOS, and other distributions.
Next Steps
- Bootloader Configuration - Bootloader guide
- GRUB Guide - GRUB setup
- grub-mkconfig Documentation:
man grub-mkconfig
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.