9

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 ?

4

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.

2
  • 1
    As far as I can tell, even the newest Centos 6 releases (e.g. Centos 6.5 and Centos 6.8 - which I have in my environment) only have GRUB 0.97, and do not have grub2-mkconfig or (an older alternate?) grub-mkconfig. Grubby itself seems be "the tool" for generating the config. I am in the same predicament as the OP. I see no way to upgrade GRUB 0.97 to GRUB2 on Centos 6, and I'm not sure how to make Grubby work, so the only alternative I'm seeing is to manually edit the config file myself. I can do this, but that scales poorly when you have a cluster with over 100 hosts. Any other suggestions? – SeligkeitIstInGott Oct 21 '16 at 19:11
  • -bash: grub2-mkconfig: command not found. -bash: /usr/sbin/grub2-mkconfig: No such file or directory. – Chloe Feb 16 '18 at 2:50
2

It works fine for me:

mv /boot/grub/grub.conf /boot/grub/bk_grub.conf
yum -y update && yum -y reinstall kernel
3
  • 7
    Although the code is appreciated, it should always have an accompanying explanation. This doesn't have to be long but it is expected. – peterh May 14 '15 at 13:16
  • This didn't work for me. – isedev Jul 26 '16 at 12:20
  • This doesn't re-create the grub.conf file. – Chloe Feb 16 '18 at 2:59
1

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
1
  • For me since /etc/grub.conf linked to /boot/grub/grub.conf, just doing rm /boot/grub/grub.conf made the grubby error go away. (On Centos7, doing make install of a custom linux kernel 4.15.5) – wxz Mar 19 at 22:36
1

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.

-2

I guess this line

    title linux centos6_64

should be just

title linux centos6_64

(removing the indentation should help)

2
  • It was just copy-paste here ;) – Marek Zakrzewski Mar 6 '15 at 13:21
  • 1
    The funny thing is the server booted itself after about 10 minutes ;) I don't know what's was wrong since I don't have access to KVM on this server. – Marek Zakrzewski Mar 6 '15 at 13:22
-2

Check /var/log/grubby to find the source of the error.

In my case, this error message was caused by a bug when using a btrfs root install on CentOS 7 (rhboot grubby bug #22). Root is actually a btrfs subvolume named /root, so the grub entries for loading the kernels point to /root/boot/vmlinuz-* but the /root/boot/ path is not accessible when /root is mounted at /.

A simple workaround is to make /root/boot a valid path that points to /boot by doing:

ln -s /boot /root/boot
1
  • /var/log/grubby: No such file or directory – Chloe Feb 16 '18 at 3:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.