Centos6

核心更新後 grub.conf 缺少 initrd 路徑

  • June 5, 2017

我今天早上更新了一個伺服器,最新的核心在啟動過程中出現了恐慌。在查看 grub.conf 文件後,我發現缺少 initrd 路徑。有沒有辦法解決這個問題?或者我應該從 grub.conf 中刪除最新的核心條目並從以前的核心啟動(測試工作)?

grub.conf 文件:

# 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

我發現這個連結解釋瞭如何重新建構初始化文件。重建初始化程序

不完全了解所有風險,這是一個好主意嗎?這是一個生產伺服器,我不想完全關閉它。:)

您可以initrd自己添加背面。

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

您應該檢查您的/boot目錄並確保它確實存在。

要永久修復它以供將來升級,請執行

# yum reinstall kernel.x86_64

如果您可以啟動到較舊的核心版本之一,請查看是否可以執行update-grub以解決該問題。否則,正如邁克爾所說,假設實際的 initrd 文件存在,您可以手動添加條目。

引用自:https://serverfault.com/questions/609929