4

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. :)

prodigerati
  • 164
  • 1
  • 7
  • If it fails to boot in a VPS/EC2 instance where you don't have arrow keys, mount it to another instance and edit the file to change `default=1` and it will select the 2nd entry. – Chloe Jun 05 '17 at 16:41

2 Answers2

4

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
Chloe
  • 1,094
  • 4
  • 16
  • 34
Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
1

If you can boot into one of the older kernel versions, see if you can run update-grub to fix the issue. Otherwise, as Michael said, you can just add the entry in by hand supposing the actual initrd file exists.

Unix-Ninja
  • 246
  • 1
  • 3