导读 | GNU GRUB(GRand Unified Bootloader简称“GRUB”)是一个来自GNU项目的多操作系统启动程序。GRUB是多启动规范的实现,它允许用户可以在计算机内同时拥有多个操作系统,并在计算机启动时选择希望运行的操作系统。GRUB可用于选择操作系统分区上的不同内核,也可用于向这些内核传递启动参数。 |
环境:Red Hat Enterprise Linux Server release 7.3
查看系统信息并重现故障
[root@localhost ~]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: RedHatEnterpriseServer Description: Red Hat Enterprise Linux Server release 7.3 (Maipo) Release: 7.3 Codename: Maipo [root@localhost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/rhel-root 50G 22G 29G 43% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 88K 1.9G 1% /dev/shm tmpfs 1.9G 9.0M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 1014M 174M 841M 18% /boot /dev/sr0 3.6G 3.6G 0 100% /media/cdrom /dev/mapper/rhel-home 46G 33M 46G 1% /home tmpfs 378M 8.0K 378M 1% /run/user/0 [root@localhost grub2]# grub2-install -V grub2-install (GRUB) 2.02~beta2 #用grub2-install --version也可以查看grub版本信息 [root@localhost ~]# ls /boot/grub2/ device.map fonts grub.cfg grubenv i386-pc locale themes [root@localhost ~]# rm -rf /boot/grub2/grub.cfg [root@localhost ~]# reboot
故障重现
手动引导系统
重装grub
[root@localhost ~]# ls /boot/grub2/ device.map fonts grubenv i386-pc locale themes [root@localhost ~]# grub2-mkconfig > /boot/grub2/grub.cfg Generating grub configuration file ... Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64 Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-f0bcb62b11a44643824cde1c7f3833e4 Found initrd image: /boot/initramfs-0-rescue-f0bcb62b11a44643824cde1c7f3833e4.img done [root@localhost ~]# ls /boot/grub2/ device.map fonts grub.cfg grubenv i386-pc locale themes [root@localhost ~]# reboot #重启验证修复结果
重启后能再次成功进入系统,说明修复成功!
本文原创地址://q13zd.cn/fix-grub-exceptions.html编辑:public,审核员:逄增宝