CentOS6 – Grub.conf Missing Initrd Path After Kernel Update

centos6grubkernel

I updated a server this morning and the latest kernel panics during boot. Upon review of the grub.conf file I found the initrd path was missing. Is there a way to fix this issue? Or should I remove the most recent kernel entry from grub.conf and boot from the previous kernel (tested working)?

grub.conf file:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/vg_spots-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/vda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-431.20.3.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-431.20.3.el6.x86_64 ro root=/dev/mapper/vg_spots-lv_root rd_LVM_LV=vg_spots/lv_root rd_LVM_LV=vg_spots/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
title CentOS (2.6.32-358.14.1.el6.x86_64)
    root (hd0,0)
    kernel /vmlinuz-2.6.32-358.14.1.el6.x86_64 ro root=/dev/mapper/vg_spots-lv_root rd_LVM_LV=vg_spots/lv_root rd_LVM_LV=vg_spots/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us crashkernel=auto rhgb quiet
    initrd /initramfs-2.6.32-358.14.1.el6.x86_64.img

I found this link explaining how to re-build the init file. Rebuild Initrd

Not totally understanding all the risks, would this be a good idea to try? This is a production server and I don't want to take it down completely. 🙂

Best Answer

You can just add the initrd back in yourself.

initrd /initramfs-2.6.32-431.20.3.el6.x86_64.img

You should check your /boot directory and ensure that it is actually present.

To fix it permanently for future upgrades, run

# yum reinstall kernel.x86_64