CentOS / RHEL 7 : How to reinstall GRUB2 from rescue mode (EFI)

CentOS / RHEL 7 now includes GRUB2 which uses a new way of installing to the MBR of your boot device. You may have to reinstall the GRUB2 bootloader if your system is not bootable after a failure. In order to reinstall GRUB2 you have to boot into rescue mode. Follow the steps below to boot into rescue mode and reinstall GRUB2 bootloader.

Booting into rescue mode and reinstalling GRUB2

1. Boot from the RHEL7 installation DVD by altering the boot order in Bios and selecting DVD media as the first booting preference.

Note : Older version of RHEL 7 DVD will not work here. So make sure you have latest version RHEL 7 DVD with you.

2. At the boot screen, Select the Troubleshooting option at the end of the screen.

 

troubleshooting option for RHEL 7 rescue mode

3. At the next screen, select the option Rescue a CentOS Linux system.

rescue a centos 7 system reinstall GRUB2

4. On the next screen, press enter to continue. When asked if you would like Rescue to find your installation, choose Continue.

find linux installation for rescue mode RHEL 7 reinstall GRUB2

If you run into trouble detecting your install, retry using the Skip option and manually detect and mount your storage. You would get a message shown in the picture below if the rescue mode has detected the correct installation.

system has been mounted under :mnt:sysimage RHEL 7 reinstall GRUB2

5. Next step is to change your root directory to /mnt/sysimage using the chroot command. This makes your system the root environment.

# chroot /mnt/sysimage

6. Use the grub2-install command to re-write the MBR to your boot device. The boot device is usually /dev/sda.

# grub2-install /dev/sda

You should get a successful installation message as shown below.

grub2-install RHEL 7

To reboot the system first exit from the chroot environment and the run reboot command.

Reinstalling grub2 on UEFI-based machines

If you are on an UEFI-based machine, make sure you add the below 2 steps as well before you re-install GRUB2 using “grub2-install” command.

1. If the EFI System Partition has been recreated or damaged, these files can be recovered by reinstalling the grub2-efigrub2-efi-modules and shim packages.

# yum reinstall grub2-efi grub2-efi-modules  shim

2. If /boot/efi/EFI/redhat/grub.cfg has been removed or damaged, it can be restored with the following command:

# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

 

 

Filed Under: CentOS/RHEL 7Linux

Some more articles you might also be interested in …

  1. lvcreate/lvremove Failed with Error “Can’t remove merging snapshot logical volume”
  2. CentOS / RHEL : How to configure vsftpd to use ports other than the default ports 20 and 21
  3. How to shrink root filesystem on CentOS / RHEL 6
  4. How to Move Swap From Disk Partition to LVM Volume in Linux
  5. CentOS / RHEL LVM : Backing Up Volume Group Metadata
  6. CentOS / RHEL 7 : How to install and configure ftp server (vsftpd)
  7. CentOS / RHEL 7 : systemctl replacements of legacy commands service and chkconfig
  8. How to Enable/Disable CPUs (Limiting CPU count) in CentOS / RHEL
  9. How to Create a Custom Log File Rotation by logrotate in Linux
  10. How to Remove/ Disable Bash shell Command History on Linux

 

转载至https://www.thegeekdiary.com/centos-rhel-7-how-to-reinstall-grub2-from-rescue-mode/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值