我的 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
此错误将显示在每个apt 升级:
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