Linux mkinitcpio Guide - ryzendew/Linux-Tips-and-Tricks GitHub Wiki
Linux mkinitcpio Guide
Complete beginner-friendly guide to mkinitcpio on Linux, covering Arch Linux, CachyOS, and other distributions including initramfs generation, kernel image creation, and boot image management.
Table of Contents
Understanding mkinitcpio
What is mkinitcpio?
mkinitcpio generates initramfs images.
Uses:
- Generate initramfs: Create initramfs images
- Boot images: Create boot images
- Kernel modules: Include kernel modules
- Boot preparation: Prepare boot images
Note: Arch Linux specific tool.
mkinitcpio Basics
Generate Image
Basic usage:
# Generate initramfs
sudo mkinitcpio -p linux
# -p = preset (generates for kernel preset)
All Presets
Generate all:
# Generate for all presets
sudo mkinitcpio -P
# -P = all presets
Generating Images
Specific Kernel
For kernel:
# Specific kernel
sudo mkinitcpio -k 6.1.0-arch1 -g /boot/initramfs-linux.img
# -k = kernel version
# -g = generate (output file)
Verbose Mode
Show progress:
# Verbose mode
sudo mkinitcpio -v -p linux
# -v = verbose (shows progress)
Configuration
Configuration File
Edit config:
# Edit configuration
sudo vim /etc/mkinitcpio.conf
# Configure hooks, modules, etc.
Hooks
Configure hooks:
# In /etc/mkinitcpio.conf
HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
Troubleshooting
mkinitcpio Not Found
Check installation:
# Check mkinitcpio
which mkinitcpio
# Install if missing
sudo pacman -S mkinitcpio
Summary
This guide covered mkinitcpio usage, initramfs generation, and boot image creation for Arch Linux, CachyOS, and other distributions.
Next Steps
- Initramfs - Initramfs guide
- Kernel Management - Kernel management
- Boot Process - Boot process guide
- mkinitcpio Documentation:
man mkinitcpio
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.