The mkinitrd command is used to create the initrd image for preloading the kernel modules. Various options of the mkinitrd command are given in the following table.
Option | Description |
---|---|
—preload={module name} | Load a module in the initrd image before the loading of other modules. |
–with={module name} | Load a module in the initrd image after the loading of other modules. |
-f | Overwrite an existing initrd image file. |
—nocompress | Disable the compression of the initrd image. |
Syntax
The syntax of the mkinitrd command is:
# mkinitrd [options] {initrd image name} {kernel version}
The following example creates an initrd image from the current kernel version and names the image initrd-[kernel version].img:
# mkinitrd /boot/initrd-$(uname -r).img $(uname -r)
If you encounter the below error while running the mkinitrd command:
mkinitrd: command not found
you may try installing the below package as per your choice of distribution:
OS Distribution | Command |
---|---|
Debian | apt-get install dracut |
Ubuntu | apt-get install dracut |
Kali Linux | apt-get install dracut |
CentOS | yum install dracut |
Fedora | dnf install dracut |
Raspbian | apt-get install dracut |