Filters
How to search
  • Plain words find names, texts and examples.
  • "two words" finds the exact phrase.
  • --name or -x finds an option.
  • #word looks only inside commands.
  • @grep finds lessons and labs that use grep.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Put ! before a word to leave it out. OR between words means one of them.
  • ↑ ↓ to move · Enter to open · Esc to close · / to search

lsinitrd

Show the content of an initramfs image: dracut modules, files, kernel modules, and the content of single files.

Level
Everyday Linux
Group
Kernel and hardware
Needs root
For changes
Package
dracut

What it does

lsinitrd without arguments shows the initramfs of the running kernel: the dracut version and arguments, the dracut modules used, and a file list. With -f FILE it prints one file from the image — useful to check if a config (like /etc/fstab or a modprobe file) is inside.

How to write it

lsinitrd [OPTION]... [IMAGE [FILE]...]
lsinitrd [OPTION]... -k KERNEL-VERSION

Options 8

Most used

-k, --kver VERSION
The image of this kernel version.
-f, --file FILE
Print the content of this file from the image.
-m, --mod
List only the dracut modules.
-s, --size
Sort files by size.
--unpack
Unpack the image into the current folder.
--unpackearly
Unpack only the early part (microcode).
-v, --verbose
Verbose (with --unpack).
-h, --help
Show help.

Examples 10

$ run as a normal user# run as root (or with sudo)

  1. 1Image of the running kernel

    lsinitrd | less

    Header, dracut modules, file list.

  2. 2Only the dracut modules

    lsinitrd -m

    lvm, crypt, systemd …

  3. 3Is a driver inside?

    lsinitrd | grep -E 'virtio_blk|nvme'

    The root disk driver must be there.

  4. 4Show a file from the image

    lsinitrd -f /etc/modprobe.d/loop.conf

    Check that your config is included.

  5. 5Image of another kernel

    lsinitrd -k 6.12.0-55.el10.x86_64 | head

    Before you boot that kernel.

  6. 6Biggest files

    lsinitrd -s | head

    Why is the image so big?

  7. 7Unpack to look around

    mkdir /tmp/ird && cd /tmp/ird && lsinitrd --unpack /boot/initramfs-$(uname -r).img

    Full file tree.

  8. 8Check LVM names inside

    lsinitrd -f /etc/lvm/lvm.conf | grep -v '^\s*#' | grep -v '^\s*$' | head

    After renaming a VG, rebuild with dracut.

  9. 9Kernel arguments in the image

    lsinitrd | grep -A3 'dracut cmdline'

    Built-in arguments.

  10. 10Early microcode

    lsinitrd --unpackearly -v

    CPU microcode updates load from here.

Exit codes

0 :: Done. 1 :: Error.

Full manual

This page explains the command in simple words. The original manual has every detail.

In your terminal: man lsinitrd