LinuxCommandLibrary

initramfs-tools

Manage initramfs images

SYNOPSIS

update-initramfs [-c | -u] [-k version] [-r root] [-t] [-d] [-v] [--no-defaults]

PARAMETERS

-c, --create
    Create a new initramfs image

-u, --update
    Update an existing initramfs image (default)

-k, --kernel
    Generate image for specific kernel version

-r, --root


    Use alternative root directory for building

-t, --test
    Dry run; test without writing image

-d, --delete
    Delete initramfs image for specified kernel

-v, --verbose
    Enable verbose output during generation

--no-defaults
    Skip default hook scripts

DESCRIPTION

initramfs-tools is a set of scripts and utilities used primarily in Debian and Ubuntu systems to generate initramfs images. These images are temporary root filesystems loaded into memory by the Linux kernel during boot, enabling early userspace to mount the real root filesystem. This is crucial for complex setups involving LVM, RAID, encrypted disks, or network filesystems.

The primary command, update-initramfs, automates image creation or updates based on kernel versions. It invokes mkinitramfs to build the cpio archive containing essential modules, binaries, and scripts. Hooks in /etc/initramfs-tools/hooks/ and scripts in /etc/initramfs-tools/scripts/ allow customization, such as including firmware or filesystem tools.

During kernel installation, hooks trigger update-initramfs -c -k to ensure boot compatibility. Images are stored in /boot/ as initrd.img-<version> or initramfs-<version>.img. This replaces older initrd methods, offering greater flexibility.

CAVEATS

Requires matching kernel headers; failures may prevent booting. Custom hooks can increase image size or cause issues if misconfigured. Not used in RPM-based distros (use dracut).

CONFIGURATION

Main config in /etc/initramfs-tools/initramfs.conf: set MODULES=dep, BOOT=local; hooks in /etc/initramfs-tools/hooks/.

HOOKS AND SCRIPTS

Extend functionality with executable hooks (e.g., for cryptsetup) or scripts in /etc/initramfs-tools/scripts/.

HISTORY

Developed by Scott James Remnant (Keybuk) for Ubuntu/Debian in 2005-2006 to replace initrd-tools amid shift to upstream initramfs support in Linux 2.6. Widely adopted in Debian derivatives; evolves with kernel features like module signing.

SEE ALSO

Copied to clipboard