LinuxCommandLibrary

update-initramfs

Update the initramfs image

SYNOPSIS

update-initramfs [-u|-c|-d] [-k version] [-t] [-v] [-b directory] [mode]

PARAMETERS

-u
    Update an existing initramfs image.

-c
    Create a new initramfs image.

-d
    Delete an existing initramfs image.

-k version
    Specify the kernel version for which to update the initramfs. If not specified, the current kernel version is used.

-t
    Take over the initramfs if it exists

-v
    Enable verbose output.

-b directory
    Set the boot directory. Defaults to /boot

mode
    Specify the mode of operation (e.g., all, modules, etc.). The default is 'all'.

DESCRIPTION

The update-initramfs command is a utility used to generate and update initramfs images.
An initramfs is a small CPIO archive that the kernel loads into memory during the early stages of the boot process. It contains essential files and scripts needed to mount the root filesystem and continue booting the system.
update-initramfs automates the process of creating or updating these images, ensuring that the necessary modules and configuration files are included.
It typically reads configuration from /etc/initramfs-tools/initramfs.conf and uses scripts located in /etc/initramfs-tools/modules, /etc/initramfs-tools/hooks and /etc/initramfs-tools/scripts to customize the image.
The utility offers different modes, such as creating a new initramfs, updating an existing one, or simply displaying information about the current configuration. It is a crucial tool for managing boot sequences and ensuring that systems can boot correctly after kernel updates or changes to hardware.

CAVEATS

Incorrect usage of update-initramfs can lead to an unbootable system. Always ensure you understand the impact of your changes before running the command, especially the delete option. Be sure to always specify kernel version with -k on custom builds.

MODULES

The modules included in the initramfs are determined by the contents of /etc/initramfs-tools/modules. This file allows you to specify kernel modules that should be included in the image.
Modules can be added by simply writing the module's name in a new line in the file.
Some modules might be added automatically based on the system's hardware and configuration.

HOOKS

Hooks are scripts executed at different stages of the update-initramfs process.
These scripts allow you to customize the initramfs image by adding files, modifying configurations, or performing other actions. Hooks are located in /etc/initramfs-tools/hooks and are executed in alphabetical order.

HISTORY

The update-initramfs utility was developed to simplify the process of managing initramfs images in Debian-based systems. It evolved from earlier, more manual methods of creating and updating these images. The command aims to provide a consistent and reliable way to ensure that the initramfs contains the necessary modules and configuration files for booting the system, especially after kernel updates.

SEE ALSO

Copied to clipboard