grubby fatal error: unable to find a suitable template

I'm trying to fix my system after moving it from one server to another. It works perfectly with kernel booted via network, but not from the disk.

Reinstalling stock CentOS 6.6 kernel shows this error:

grubby fatal error: unable to find a suitable template

My /boot/grub/grub.conf file looks fine:

default=0
timeout=5
    title linux centos6_64
    kernel /vmlinuz-2.6.32-504.8.1.el6.x86_64 root=/dev/sda3  ro crashkernel=auto SYSFONT=latarcyrheb-sun16 LANG=pl_PL.UTF-8 KEYTABLE=pl
    root (hd0,1)
    initrd /initramfs-2.6.32-504.8.1.el6.x86_64.img

All files are in place:

    ls -l /boot
razem 24645
-rw-r--r-- 1 root root   106312 01-28 22:40 config-2.6.32-504.8.1.el6.x86_64
drwxr-xr-x 3 root root     1024 2011-07-08  efi
drwxr-xr-x 2 root root     1024 03-06 13:44 grub
-rw------- 1 root root 18227613 03-06 13:44 initramfs-2.6.32-504.8.1.el6.x86_64.img
-rw-r--r-- 1 root root   200245 01-28 22:41 symvers-2.6.32-504.8.1.el6.x86_64.gz
-rw-r--r-- 1 root root  2544888 01-28 22:40 System.map-2.6.32-504.8.1.el6.x86_64
-rwxr-xr-x 1 root root  4153008 01-28 22:40 vmlinuz-2.6.32-504.8.1.el6.x86_64

    ls -l /boot/grub/
razem 259
-rw-r--r-- 1 root root     15 03-02 20:55 device.map
-rw-r--r-- 1 root root     63 2011-07-08  device.map.backup
-rw-r--r-- 1 root root  13396 03-06 13:05 e2fs_stage1_5
-rw-r--r-- 1 root root  12636 03-06 13:05 fat_stage1_5
-rw-r--r-- 1 root root  11780 03-06 13:05 ffs_stage1_5
-rw------- 1 root root    242 03-06 13:44 grub.conf
-rw-r--r-- 1 root root  11772 03-06 13:05 iso9660_stage1_5
-rw-r--r-- 1 root root  13284 03-06 13:05 jfs_stage1_5
lrwxrwxrwx 1 root root     11 03-06 13:04 menu.lst -> ./grub.conf
-rw-r--r-- 1 root root  11972 03-06 13:05 minix_stage1_5
-rw-r--r-- 1 root root  14428 03-06 13:05 reiserfs_stage1_5
-rw-r--r-- 1 root root   1341 2010-11-14  splash.xpm.gz
-rw-r--r-- 1 root root    512 03-06 13:05 stage1
-rw-r--r-- 1 root root 126116 03-06 13:05 stage2
-rw-r--r-- 1 root root  12040 03-06 13:05 ufs2_stage1_5
-rw-r--r-- 1 root root  11380 03-06 13:05 vstafs_stage1_5
-rw-r--r-- 1 root root  13980 03-06 13:05 xfs_stage1_5

/etc/fstab looks fine too:

    cat /etc/fstab
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
/dev/sda3       /       ext4    rw,noatime,nodiratime,usrjquota=aquota.user,grpjquota=aquota.group,usrquota,grpquota,jqfmt=vfsv0        0       1
/dev/sda2       /boot   ext4    errors=remount-ro       0       1
/dev/sda4       swap    swap    defaults        0       0
proc            /proc   proc    defaults                0       0
sysfs           /sys    sysfs   defaults                0       0
tmpfs           /dev/shm        tmpfs   defaults        0       0
devpts          /dev/pts        devpts  defaults        0       0

How to resolve this ?


Somewhat of a late response, but just faced the same problem with CentOS 7 minimal install.

Solution was to run: grub2-mkconfig -o /boot/grub2/grub.cfg after upgrading the kernel.

Note that does not set the new kernel as the default in the boot menu.


It works fine for me:

mv /boot/grub/grub.conf /boot/grub/bk_grub.conf
yum -y update && yum -y reinstall kernel

I found a solution here:

http://www.itekhost.net/grubby-fatal-error/

rm /boot/grub/grub.conf
rm /etc/grub.conf
yum reinstall kernel

I believe the problem was /etc/grub.conf because I tried one of these answers and moved /boot/grub/grub.conf and it didn't help.

However, I'm also getting this error too.

/sbin/new-kernel-pkg: line 310: 32483 Killed                  depmod -ae -F /boot/System.map-$version $version

With CentOS release 7.7.1908:

sudo yum reinstall kernel

This seems to have corrected the problem.

Note that /boot/grub/grub.cfg is a symlink to /boot/grub2/grub.cfg, and the latter was properly (it seems) replaced with the new version with the yum reinstall kernel. Similarly, /etc/grub2.cfg -> /boot/grub2/grub.cfg.