Skip to Content

initramfs (Dracut) Command Reference

Starting with Ubuntu 26.04, the initramfs build tool changed from initramfs-tools to Dracut. The day-to-day commands change accordingly: the old update-initramfs and lsinitramfs are replaced by dracut and lsinitrd, and the configuration directory becomes /etc/dracut.conf.d/.

Note

Systems upgraded to 26.04 may still keep initramfs-tools, in which case the old commands still work. Fresh installs use Dracut by default. Confirm with which dracut / dracut --version.

Command Mapping

Old (initramfs-tools)New (Dracut)Description
sudo update-initramfs -usudo dracut -fRebuild the initramfs for the current kernel (-f overwrites the existing file)
sudo update-initramfs -u -k allsudo dracut -f --regenerate-allRebuild for all installed kernels
sudo update-initramfs -u -k $(uname -r)sudo dracut -f --kver $(uname -r)Build for a specific kernel version
lsinitramfs /boot/initrd.img-$(uname -r)lsinitrdList files included in the initramfs
lsinitramfs … | grep xxxlsinitrd | grep xxxCheck whether a module/file is packed in
/etc/initramfs-tools//etc/dracut.conf.d/Configuration directory
/etc/initramfs-tools/modulesforce_drivers+=" MODULE " (in conf.d)Force-include a kernel module

Common Operations

# Rebuild the initramfs for the current kernel sudo dracut -f # Rebuild for all installed kernels (common after changing drivers, encryption, resume, etc.) sudo dracut -f --regenerate-all # Build for a specific kernel version to a specific path sudo dracut -f /boot/initrd.img-7.0.0-10-generic 7.0.0-10-generic

Inspecting the initramfs

# View the contents of the current kernel's initramfs (defaults to the current kernel) lsinitrd # Inspect a specific file lsinitrd /boot/initrd.img-$(uname -r) # Confirm whether a kernel module is packed in (e.g. resume, encryption, NIC driver) lsinitrd | grep -i resume lsinitrd | grep -i nvme

Configuring Dracut

Dracut configuration lives in *.conf files under /etc/dracut.conf.d/. Changes only take effect after rebuilding the initramfs.

# Example: force-pack certain drivers into the initramfs echo 'force_drivers+=" nvme nvme_core "' | sudo tee /etc/dracut.conf.d/90-nvme.conf sudo dracut -f --regenerate-all

Common configuration options:

# /etc/dracut.conf.d/zz-local.conf # Pack only modules needed by this host (smaller, the default behavior) hostonly="yes" # Force-include specific kernel drivers force_drivers+=" MODULE " # Add specific dracut modules (such as crypt, lvm, network) add_dracutmodules+=" crypt lvm " # Include extra executables in the initramfs install_items+=" /usr/bin/vi "
Tip

After changing resume (hibernation), disk encryption, or the driver for the controller holding the root filesystem, remember to run sudo dracut -f --regenerate-all, or the system may fail to boot.

Last updated on