dracut is a modular initramfs generator for Linux: it assembles the small compressed archive that the kernel unpacks into memory at boot and runs before the real root filesystem is mounted. Inside that early environment, dracut-built code loads drivers, assembles RAID and LVM volumes, unlocks encrypted disks, brings up the network when needed, mounts the root filesystem and then hands control to the system init, normally systemd.
In Linux system initialization, dracut sits between the boot loader and the init system. It is the default initramfs tool on Fedora, RHEL and its rebuilds, openSUSE and several other distributions, and is now developed largely in the community fork dracut-ng, which most of those distributions have adopted.
How dracut builds an initramfs
dracut builds the image by running a set of shell-based modules, each of which copies the binaries, libraries, kernel modules, udev rules and scripts it needs into a staging directory. The directory is then packed as a cpio archive and compressed, typically with zstd, xz or gzip, and written to a path such as /boot/initramfs-6.11.4.img.
Modules live in /usr/lib/dracut/modules.d/ in numbered directories such as 90lvm, 90crypt or 95nfs, where the number sets the order. Each module provides a module-setup.sh script with standard functions that decide whether it applies and what it installs.
| Function | Purpose | Example behavior |
|---|---|---|
| check() | Decides whether the module is needed | Returns 0 only if LVM volumes exist |
| depends() | Lists other modules it requires | crypt depends on dm and systemd |
| install() | Copies binaries, rules and hook scripts | Installs cryptsetup and its udev rules |
| installkernel() | Adds required kernel modules | Adds dm_crypt and cipher drivers |
Distribution kernel packages call dracut automatically after every kernel update, usually through kernel-install plugins, so administrators rarely run it by hand except after changing storage, drivers or configuration.
What happens inside the dracut initramfs at boot
At boot, the dracut initramfs runs an event-driven sequence: udev discovers devices as they appear, and dracut waits until the configured root device exists instead of sleeping for fixed periods. On modern systems the early environment itself runs systemd in the initramfs, with dracut providing units for each stage.
- cmdline parses the kernel command line, for example root= and rd.* options.
- pre-udev and pre-trigger prepare udev rules before devices are probed.
- initqueue loops while devices appear, assembling RAID, LVM and LUKS volumes.
- pre-mount and mount check and mount the root filesystem on /sysroot.
- pre-pivot and cleanup finish tasks, then switch_root starts the real init.
If the root device never appears, dracut times out and drops into an emergency shell, which is the main reason it is valued for troubleshooting.
Configuring dracut and its key options
dracut reads /etc/dracut.conf and drop-in files in /etc/dracut.conf.d/, and the same settings can be passed on the command line. Drop-in files are the preferred method because package updates do not overwrite them.
| Option or setting | Effect | Typical use |
|---|---|---|
--hostonly / hostonly=yes | Includes only what this machine needs | Smaller, faster images |
--no-hostonly | Builds a generic image for any hardware | Rescue images, disk migration |
--add / add_dracutmodules+= | Forces extra modules into the image | Adding network or iSCSI support |
--omit / omit_dracutmodules+= | Excludes specific modules | Removing unused Plymouth or NFS |
--force --kver | Rebuilds an image for one kernel version | After editing configuration |
--regenerate-all | Rebuilds images for all installed kernels | After a driver or storage change |
--uefi | Produces a unified kernel image | Secure Boot and systemd-boot setups |
The built image can be inspected with lsinitrd, which lists its files and the modules it contains; checking it before a reboot catches missing drivers or keys early.
dracut compared with other initramfs tools
dracut is one of several initramfs generators on Linux, and each distribution family has its own default. They produce the same kind of artifact, an initramfs, but differ in structure and ecosystem.
| Tool | Main distributions | Design notes |
|---|---|---|
| dracut | Fedora, RHEL, openSUSE, Void | Event-driven, numbered shell modules, systemd-based |
| mkinitcpio | Arch Linux | Hook-based, configured in mkinitcpio.conf |
| initramfs-tools | Debian, Ubuntu | Script hooks, update-initramfs command |
| booster | Optional on Arch | Go-based, focused on fast generation and boot |
Arch Linux and Ubuntu have both evaluated or offered dracut as an alternative, so dracut skills transfer widely across enterprise and desktop distributions.
Troubleshooting dracut boot failures
Most dracut problems show up as a boot that stops in the emergency shell with a message that the root device could not be found. The kernel command line offers several rd.* debugging parameters for these cases.
| Symptom | Likely cause | Fix |
|---|---|---|
| Timeout waiting for root device | Storage driver missing from host-only image | Rebuild with the driver or –no-hostonly |
| No passphrase prompt for LUKS | crypt module omitted or wrong rd.luks.uuid | Add crypt, correct the kernel command line |
| Old settings still active | Image not rebuilt after config change | Run dracut –force for that kernel |
| Boot fails after moving disks | Host-only image tied to old hardware | Boot a rescue entry, regenerate all images |
- rd.break=pre-mount stops at a chosen hook and opens a shell for inspection.
- rd.shell permits a shell after a failure, and rd.debug logs every script step.
- rd.lvm.lv= and rd.luks.uuid= restrict which volumes dracut activates.
A non-technical view
When a Linux computer starts, it faces a chicken-and-egg problem: the operating system lives on a disk, but the computer may need special software to read that disk, for example to unlock encryption or combine several drives.
dracut solves this by packing a small starter kit ahead of time. The kit is loaded into memory at power-on, opens the real disk, and then steps aside for the full system. If something is missing from the kit, the computer stops early and offers a repair console.
A concrete example
An administrator at a university lab migrates a RHEL server from a single SATA disk to a new NVMe drive inside an encrypted LUKS container with LVM on top. After copying the data and updating /etc/crypttab and the GRUB entry, the first reboot stops in the dracut emergency shell, because the old host-only image contains no NVMe or dm-crypt drivers.
Booting the rescue entry, the administrator adds a drop-in file with add_dracutmodules+=" crypt lvm ", runs dracut --force --regenerate-all, and confirms with lsinitrd | grep nvme that the driver is present. On the next boot the passphrase prompt appears and the server reaches its normal login screen in about twenty seconds, with the fixed configuration preserved for every future kernel update.