mkinitcpio(8)
Create an initial ramdisk (initramfs) image for the Linux kernel.
Synopsis
mkinitcpio [OPTION]... [-o OUTPUT] [KERNELVERSION]Description
mkinitcpio creates an initial ramdisk (initramfs) image containing the kernel modules, firmware, and hooks needed to mount the root filesystem and boot the system. It reads configuration from /etc/mkinitcpio.conf and supports custom presets for different boot scenarios.
The initramfs is loaded by the bootloader before the kernel mounts the real root filesystem. It typically handles device detection, decryption, LVM setup, and RAID initialization.
Common options
| Flag | What it does |
|---|---|
-o, --output FILE | write the image to FILE instead of default location |
-c, --config FILE | use FILE instead of /etc/mkinitcpio.conf |
-k, --kernel VERSION | build initramfs for kernel VERSION (default: uname -r) |
-p, --preset PRESET | build initramfs from preset in /etc/mkinitcpio.d/PRESET.preset |
-L, --listhooks | list all available hooks |
-M, --listmodules | list all available modules for current kernel |
-H, --hookhelp HOOK | show help text for the specified hook |
-n, --nocolor | disable colored output |
-S, --skiphooks HOOK | skip specified hooks (comma-separated) |
-A, --add HOOK | add additional hook to the image |
-v, --verbose | enable verbose output |
-t, --tmpdir DIR | use DIR for temporary files instead of /tmp |
Examples
Build initramfs for all presets defined in /etc/mkinitcpio.d/linux.preset
mkinitcpio -p linuxCreate initramfs for specific kernel version and save to custom location
mkinitcpio -k 6.1.0-arch1-1 -o /boot/initramfs-custom.imgList all available hooks (like filesystems, keyboard, lvm2, encrypt, etc.)
mkinitcpio -LShow help and documentation for the encrypt hook
mkinitcpio -H encryptCreate initramfs using alternate configuration file
mkinitcpio -c /etc/mkinitcpio-fallback.conf -o /boot/initramfs-fallback.imgBuild initramfs skipping fsck hook and adding sd-vconsole hook
mkinitcpio -S fsck -A sd-vconsoleBuild with verbose output to see what modules and hooks are included
mkinitcpio -v -o /boot/initramfs-test.img