Rocky 9.x Rebuilding Initial Ramdisk (initrd/initramfs) to solve boot issue

From Notes_Wiki

Home > Rocky Linux or CentOS > Rocky Linux 9.x > System Administration > Troubleshooting boot issues > Rebuilding Initial Ramdisk (initrd/initramfs)

Rebuilding Initial Ramdisk (initrd/initramfs) in Rocky Linux 9.x

This article provides steps to rebuild the initial ramdisk (initrd/initramfs) file in Rocky Linux 9.x. This process can help resolve boot issues related to the initrd file.

Prerequisites

  • Access to the system (either normal boot or rescue mode)
  • Root or sudo privileges

Steps to Rebuild initrd

1. Access the System

If your system is not booting normally, you may need to boot into rescue mode using bootable installation media or a rescue disc.

2. Identify the Kernel Version

Determine the kernel version for which you need to rebuild the initrd:

 ls /boot/vmlinuz-*

Note the version number of the kernel you want to use.

3. Rebuild Initrd

Use the dracut command to rebuild the initrd:

 dracut --force /boot/initramfs-KERNEL_VERSION.img KERNEL_VERSION

Replace KERNEL_VERSION with the actual version number you identified in step 2. The --force option ensures that the initrd is rebuilt even if it already exists.

4. Update GRUB Configuration

After rebuilding the initrd, update the GRUB configuration:

 grub2-mkconfig -o /boot/grub2/grub.cfg

This ensures that the new initrd image is used during boot.

5. Reboot the System

Once the initrd is rebuilt and GRUB is updated, reboot the system to apply the changes:

 reboot


Troubleshooting

If you continue to experience boot issues after rebuilding the initrd:

  • Check hardware connections
  • Verify that all necessary kernel modules are included in the initrd
  • Consult the Rocky Linux forums or documentation for further assistance


Home > Rocky Linux or CentOS > Rocky Linux 9.x > System Administration > Troubleshooting boot issues > Rebuilding Initial Ramdisk (initrd/initramfs)