CloudLinux Boot Fail | /etc/grub2.cfg points to the wrong file instead of /boot/grub2/grub.cfg

Hello,

Error :

/sbin/dracut: line 1137: /proc/crypto: No such file or directory
grep: /boot/grub2/grub.cfg: No such file or directory
grep: /boot/grub2/grub.cfg: No such file or directory

[WARNING] /boot/grub2/grub.cfg is missing
[WARNING] Kernel 3.10.0-614.10.2.lve1.4.56.el7.x86_64 GRUB entry is missing
[WARNING] Kernel 3.10.0-614.10.2.lve1.4.56.el7.x86_64 initramfs GRUB entry is missing
[WARNING] /etc/grub2.cfg is not a link
[WARNING] /etc/grub2.cfg points to the wrong file instead of /boot/grub2/grub.cfg

CloudLinux Boot Fail | /etc/grub2.cfg points to the wrong file instead of /boot/grub2/grub.cfg, Hostripples Web Hosting

 

This is may be due to EFI enabled boot.

To Fix this issue follow the below steps :

# ls -la /boot/efi/EFI/centos/
total 2024
drwxr-xr-x 3 root root    4096 Jun 23 00:31 .
drwxr-xr-x 3 root root    4096 Jun 22 11:39 ..
drwxr-xr-x 2 root root    4096 Jun 23 00:28 fonts
-rwxr-xr-x 1 root root 1024736 Nov  7  2016 gcdx64.efi
-rwxr-xr-x 1 root root    1024 Jun 23 21:42 grubenv
-rwxr-xr-x 1 root root 1024736 Nov  7  2016 grubx64.efi
( as you can see, there is no config file grub.cfg above)

# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
(the config has been generated)
# ls -la /boot/efi/EFI/centos/grub.cfg
-rwxr-xr-x 1 root root 5235 Jun 24 06:15 /boot/efi/EFI/centos/grub.cfg

# ls -la /etc/grub2.cfg
lrwxrwxrwx 1 root root 22 Jun 23 00:28 /etc/grub2.cfg -> ../boot/grub2/grub.cfg

# rm /etc/grub2.cfg
rm: remove symbolic link ‘/etc/grub2.cfg’? y

# ln -s ../boot/efi/EFI/centos/grub.cfg /etc/grub2.cfg

# ls -la /etc/grub2.cfg
lrwxrwxrwx 1 root root 31 Jun 24 06:22 /etc/grub2.cfg -> ../boot/efi/EFI/centos/grub.cfg
(i.e. the symlink has been corrected to point to the new correct grub.cfg in EFI)


After the next/each kernel update please ensure that the file /boot/efi/EFI/centos/grub.cfg 
contains the new kernel or just re-generate it by running:
# grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg
I think the action above should be done automatically during the kernel update and you don't need to 
check it manually -- but I wish to inform you about this, so you'll be aware and recheck just to 
ensure that grub.cfg is Ok before the next reboot.

Also if the system uses EFI, then the following command will show you the boot order (in other case, 
it will show nothing/error):
# efibootmgr
BootCurrent: 0000
Timeout: 1 seconds
BootOrder: 0004,0005,0006,0007,0008,0009,0000,0002,000A
Boot0000* centos
Boot0002  UEFI: Built-in EFI Shell
Boot0004* UEFI: Intel(R) I350 Gigabit Network Connection
Boot0005* UEFI: IP4 Intel(R) I350 Gigabit Network Connection
Boot0006* UEFI: IP6 Intel(R) I350 Gigabit Network Connection
Boot0007* UEFI: Intel(R) I350 Gigabit Network Connection
Boot0008* UEFI: IP4 Intel(R) I350 Gigabit Network Connection
Boot0009* UEFI: IP6 Intel(R) I350 Gigabit Network Connection
Boot000A  Hard Drive




CloudLinux Boot Fail | /etc/grub2.cfg points to the wrong file instead of /boot/grub2/grub.cfg, Hostripples Web Hosting
HR-ADMIN