OVH CentOS 7 server grub rescue prompt

On an OVH Cpanel server running CentOS 7, the server won’t boot. When accessing the server console using IPMI, I found the following error.

OVH IPMI server console

I booted the server into rescue mode, checked the disk partitions with the command parted -l

Disk /dev/nvme0n1: 450GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name     Flags
 1      1049kB  537MB   536MB   fat32           primary  boot, esp
 2      537MB   1073MB  536MB   ext4            primary  raid
 3      1073MB  53.5GB  52.4GB  ext4            primary  raid
 4      53.5GB  450GB   396GB   ext4            primary  raid
 5      450GB   450GB   536MB   linux-swap(v1)  primary


Disk /dev/nvme1n1: 450GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name     Flags
 1      1049kB  537MB   536MB   fat32           primary  boot, esp
 2      537MB   1073MB  536MB   ext4            primary  raid
 3      1073MB  53.5GB  52.4GB  ext4            primary  raid
 4      53.5GB  450GB   396GB   ext4            primary  raid
 5      450GB   450GB   536MB   linux-swap(v1)  primary

The server had 2 NVMe disks configured as RAID 1 mirrors. The first partition with fat32 filesystem is used for boot.

To fix the problem, I chrooted to the server file system with the following command (this may be changed based on your server’s partition scheme).

mount /dev/md3 /mnt
mount /dev/md2 /mnt/boot/
mount /dev/md4 /mnt/home
mount --bind /dev /mnt/dev
mount --bind /sys /mnt/sys
mount --bind /proc /mnt/proc
mount --bind /dev/pts /mnt/dev/pts/
chroot /mnt

Reinstalled the kernel with

yum reinstall kernel

Then reinstalled grub loader. This server used UEFI, so used following commands

mkdir /nvme0n1p1
mkdir /nvme1n1p1
mount /dev/nvme0n1p1 /nvme0n1p1
mount /dev/nvme1n1p1 /nvme1n1p1
grub2-install --target=x86_64-efi --efi-directory=/nvme0n1p1 --bootloader-id=GRUB
grub2-install --target=x86_64-efi --efi-directory=/nvme1n1p1 --bootloader-id=GRUB

grub boot loaded is installed on both disks, so server will be able to boot when either one of the disk is selected as boot device.

Back to grub

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *