Grubby fatal error: unable to find a suitable template

So, I updated the kernel yum -y update kernel on my AWS EC2 base image, and I get the following:

 Running Transaction Installing : kernel-2.6.32-504.3.3.el6.x86_64 grubby fatal error: unable to find a suitable template 

Here is the contents of /boot/grub/grub.conf:

 default=0 timeout=0 hiddenmenu title CentOS (2.6.32-358.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-358.el6.x86_64 ro root=LABEL=rootfs console=ttyS0 initrd /boot/initramfs-2.6.32-358.el6.x86_64.img 

So grub.conf is not updated, and since I already have kernel-2.6.32-504.1.3.el6.x86_64 installed, grub was not updated the last time I updated the kernel. I tried to add the kernel manually:

 grubby --grub --add-kernel="/boot/vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=LABEL=rootfs \ console=ttyS0" --title="CentOS (2.6.32-504.3.3.el6.x86_64)" \ --initrd=/boot/initramfs-2.6.32-504.3.3.el6.x86_64.img 

and then /boot/grub/grub.conf looks like this:

 default=0 timeout=0 hiddenmenu title CentOS (2.6.32-504.3.3.el6.x86_64) kernel /vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=LABEL=rootfs console=ttyS0 initrd /initramfs-2.6.32-504.3.3.el6.x86_64.img title CentOS (2.6.32-358.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-358.el6.x86_64 ro root=LABEL=rootfs console=ttyS0 initrd /boot/initramfs-2.6.32-358.el6.x86_64.img 

However, /vmlinuz-2.6.32-504.3.3.el6.x86_64 not the kernel that I introduced. So I deleted this and tried again:

 grubby --grub --add-kernel="/boot/boot/vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=LABEL=rootfs \ console=ttyS0" --title="CentOS (2.6.32-504.3.3.el6.x86_64)" \ --initrd=/boot/boot/initramfs-2.6.32-504.3.3.el6.x86_64.img 

as a result:

 timeout=0 default=1 hiddenmenu title CentOS (2.6.32-504.3.3.el6.x86_64) kernel /boot/vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=LABEL=rootfs console=ttyS0 root=(hd0,0) initrd /boot/initramfs-2.6.32-504.3.3.el6.x86_64.img title CentOS (2.6.32-358.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-358.el6.x86_64 ro root=LABEL=rootfs console=ttyS0 initrd /boot/initramfs-2.6.32-358.el6.x86_64.img 

At this point, I manually edited /boot/grub/grub.conf to default=0 and rebooted and my EC2 did not boot. Therefore, I tried a new copy of the instance and received all the same errors, so I copied the existing settings to a new record:

 default=0 timeout=0 hiddenmenu title CentOS (2.6.32-504.3.3.el6.x86_64) root (hd0,0) kernel /boot/vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=LABEL=rootfs console=ttyS0 initrd /boot/initramfs-2.6.32-504.3.3.el6.x86_64.img 

And it will reboot, and it will not be able to boot again. Another attempt, I repeated above, but with root=/dev/xvda3 , and this also did not boot. Therefore, at the moment, I have no way to upgrade my kernel. What should I do?


UPDATE I figured out / boot / boot / stuff, and my / boot / grub / grub.conf now looks like this:

 default=0 timeout=0 hiddenmenu title CentOS (2.6.32-504.3.3.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-504.3.3.el6.x86_64 ro root=LABEL=rootfs console=ttyS0 initrd /initramfs-2.6.32-504.3.3.el6.x86_64.img 

And I can successfully boot my system, but everything else remains true: installing a new kernel still leads to a "gross fatal error: you cannot find a suitable template", and grubby --default-kernel still does not exit. I need to manually edit the /boot/grub/grub.conf file for any kernel update.

+6
source share
2 answers

I saw --default-kernel still does not exit during kernel update in CentOS AMI. I investigated why the results are not output using ltrace.

grub.conf seems to confirm the UUID of the root grub.conf from the ltrace outputs. I could update the kernel after I changed grub.conf to add root=UUID=[UUID from tune2fs] to my environment.

0
source

Next, the correct grub.cfg file will be created.

 grub2-mkconfig -o /boot/grub2/grub.cfg 
-1
source

Source: https://habr.com/ru/post/980326/


All Articles