我的 CentOS 6.10 主機無法啟動。它在 GRUB 提示符號處停止。如何在每次啟動時無需手動幹預的情況下解決此問題?
我可以透過這些步驟成功地讓系統運作。
root (hd0,1)
kernel /vmlinuz<version> root=/dev/sda8 ro
initrd initramfs<version matching kernel line>
boot
從那時起一切正常,直到我必須重新啟動。 uname -a顯示了我用來手動啟動系統的版本。 (是的,主機名稱是 hastur。)
$ uname -a
Linux hastur 2.6.32-754.9.1.el6.x86_64 #1 SMP Thu Dec 6 08:02:15 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
我的磁碟佈局如下:
$ lsblk -i
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
|-sda1 8:1 0 200M 0 part /boot/efi
|-sda2 8:2 0 500M 0 part /boot
|-sda3 8:3 0 73.2G 0 part /var
|-sda4 8:4 0 48.8G 0 part /home
|-sda5 8:5 0 29.3G 0 part /opt
|-sda6 8:6 0 14.7G 0 part /tmp
|-sda7 8:7 0 7.8G 0 part [SWAP]
`-sda8 8:8 0 58.4G 0 part /
sr0 11:0 1 1024M 0 rom
這些是 /etc/fstab 中的相關條目。 (我使用以下命令驗證了 /boot/efi 的短 UUIDblkid /dev/sda1)
UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 / ext4 defaults 1 1
UUID=bbec4552-4895-4ad9-a82a-e3668a9b8e4b /boot ext4 defaults 1 2
UUID=8067-187B /boot/efi vfat umask=0077,shortname=winnt 0 0
我的 grub.conf 是
$ sudo cat /boot/efi/EFI/redhat/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,1)
# kernel /vmlinuz-version ro root=/dev/sdb8
# initrd /initrd-[generic-]version.img
#boot=/dev/sdb1
device (hd0) HD(1,800,64000,6c514bde-63d4-4e1f-9306-7792c17f1e90)
default=0
timeout=5
splashimage=(hd0,1)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-754.11.1.el6.x86_64)
root (hd0,1)
kernel /vmlinuz-2.6.32-754.11.1.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
initrd /initramfs-2.6.32-754.11.1.el6.x86_64.img
title CentOS (2.6.32-754.11.1.el6.x86_64.debug)
root (hd0,1)
kernel /vmlinuz-2.6.32-754.11.1.el6.x86_64.debug ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
initrd /initramfs-2.6.32-754.11.1.el6.x86_64.debug.img
title CentOS (2.6.32-754.9.1.el6.x86_64.debug)
root (hd0,1)
kernel /vmlinuz-2.6.32-754.9.1.el6.x86_64.debug ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
initrd /initramfs-2.6.32-754.9.1.el6.x86_64.debug.img
title CentOS (2.6.32-754.9.1.el6.x86_64)
root (hd0,1)
kernel /vmlinuz-2.6.32-754.9.1.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
initrd /initramfs-2.6.32-754.9.1.el6.x86_64.img
title CentOS (2.6.32-754.6.3.el6.x86_64)
root (hd0,1)
kernel /vmlinuz-2.6.32-754.6.3.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
initrd /initramfs-2.6.32-754.6.3.el6.x86_64.img
title CentOS (2.6.32-754.3.5.el6.x86_64)
root (hd0,1)
kernel /vmlinuz-2.6.32-754.3.5.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
initrd /initramfs-2.6.32-754.3.5.el6.x86_64.img
title CentOS (2.6.32-696.30.1.el6.x86_64)
root (hd0,1)
kernel /vmlinuz-2.6.32-696.30.1.el6.x86_64 ro root=UUID=c7ba8070-e409-4a58-b31b-ddd06d784481 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet crashkernel=256M
initrd /initramfs-2.6.32-696.30.1.el6.x86_64.img
相關資訊
我在 Ubuntu 18.04 上遇到了相同的問題(都是從 16.04 升級並全新安裝。兩台主機上的硬體相同:HP Compaq 8200 Elite Small Form Factor、Intel Core i5-2500)。 Ubuntu 16.04 可以正常啟動,Ubuntu 18.04 則不能。問題是解決了上週使用了這些命令。
sudo apt-get purge grub\*
sudo apt-get install grub-efi
sudo apt-get autoremove
sudo update-grub
此錯誤會在每次顯示易於升級:
Package grub-efi-amd64-signed is not configured yet.
dpkg 報告:
iF grub-efi-amd64-signed (1.93.13+2.02-2ubuntu8.12)
iU shim-signed (1.37~18.04.3+15+1533136590.3beb971-0ubuntu1)
回到CentOS 6主機
sudo rpm -Va會告訴我這麼多。
.M....... /boot/efi/EFI/redhat
.M.....T. /boot/efi/EFI/redhat/grub.efi
我已經嘗試過從光學介質啟動並運行grub 安裝。此時,從頭開始重建不是一個選項。
附加資訊
$ sudo efibootmgr
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables.
Try 'modprobe efivars' as root.
# modprobe efivars
FATAL: Module efivars not found.
# ls -li $(locate grub.conf)
9 -rwx------. 1 root root 3626 May 25 09:31 /boot/efi/EFI/redhat/grub.conf
2885960 lrwxrwxrwx. 1 root root 32 Apr 21 2018 /etc/grub.conf -> ../boot/efi/EFI/redhat/grub.conf
2885959 lrwxrwxrwx. 1 root root 33 Apr 21 2018 /etc/grub.conf.rpmsave -> ..//boot/efi/EFI/redhat/grub.conf
# diff -wb /etc/grub.conf /etc/grub.conf.rpmsave
#
答案1
我又找了一些時間來解決這個問題。
最終引起我注意的提示是grub.conf
:“路徑是相對於/boot/
”
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,1)
# kernel /vmlinuz-version ro root=/dev/sdb8
# initrd /initrd-[generic-]version.img
我的 grub.conf 檔案位於錯誤的位置,/etc/grub.conf
.我將文件複製到/boot/grub/
,系統正常啟動。
回顧我的問題,我根本不確定我是如何運行的sudo cat /boot/efi/EFI/redhat/grub.conf
這在我的評論之一中很明顯,該評論locate grub.conf
只能在中找到一個文件/etc