Yum update kernel does not boot into new kernel and /boot/grub2/grub.config is not existing

Latest response

Hello,
We are running RHEL 7.3.
We updated using yum update to latest kernel (kernel-3.10.0-862.14.4.el7.x86_64)

yum update kernel

And rebooted the system

pm -q kernel
kernel-3.10.0-327.el7.x86_64
kernel-3.10.0-514.10.2.el7.x86_64
kernel-3.10.0-862.14.4.el7.x86_64

But the system did not boot to latest kernel

uname -a
3.10.0-514.10.2.el7.x86_64

In fact the /boot/grub2/grub.conf does not exist

ls /boot | grep grub*

Why did the yum update fail to add to /etc/grub? and what is the solution

Responses

Hi Majid,

Not easy to answer, because you didn't provide more details about what else you have done. Maybe silly question, but is the
system really installed in MBR mode on a machine with Legacy BIOS ? If that's not the case, then the GRUB configuration is
located in the /boot/efi/EFI/redhat/ directory. Anyway, the solution can be to reinstall GRUB, and then update the config :

EFI based BIOS -> sudo yum reinstall grub2-efi shim
sudo grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg

Legacy BIOS -> sudo grub2-install /dev/sdX (sdX = system disk)
sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Please report back if it solved the problem ... I wish you good luck ! :)

Regards,
Christian

Hi Majid,

In RHEL7.x release the grub configuration file is 'grub.cfg', in older release it is 'grub.conf'. Also, the file '/etc/grub.cfg' is a symbolic link to '/boot/grub2/grub.cfg' file (in case of EFI based systems /boot/efi/EFI/redhat/grub.cfg).

Looking at your problem description I presume that system boots into older kernel without any issues. If this is the case then it could be due to the reason that '/etc/grub.cfg' symbolic link file not there. Please check this.

Also, you may post the output of the following for further help:

# cat /etc/sysconfig/kernel
# grep GRUB_DEFAULT /etc/default/grub
# cat /boot/grub2/grubenv
# ls /boot

By default, there is 'grub2' folder under /boot, if this is an EFI based system then check if there is 'efi/EFI/redhat' folder under which you could see 'grub.cfg' file.

This is a Bios based system as there is no grub.cfg in /boot ````````````````````````````````````````````````````````````````````

ls /boot/efi/EFI/redhat/

#

cat /etc/sysconfig/kernel UPDATEDEFAULT specifies if new-kernel-pkg should make new kernels the default

UPDATEDEFAULT=yes

DEFAULTKERNEL specifies the default kernel package type

DEFAULTKERNEL=kernel

grep GRUB_DEFAULT /etc/default/grub

GRUB_DEFAULT=saved

cat /boot/grub2/grubenv

#

ls /boot

config-3.10.0-862.14.4.el7.x86_64 efi grub2 initramfs-0-rescue-cc1932fbd038443f9c0cda7 153d87e9e.img initramfs-3.10.0-514.10.2.el7.x86_64.img initramfs-3.10.0-514.10.2.el7.x86_64kdump. img initramfs-3.10.0-862.14.4.el7.x86_64.img symvers-3.10.0-862.14.4.el7.x86_64.gz System.map-3.10.0-862.14.4.el7.x86_64 vmlinuz-0-rescue-cc1932fbd038443f9c0cda715 3d87e9e vmlinuz-3.10.0-862.14.4.el7.x86_64

ls -l /etc/grub2.cfg lrwxrwxrwx. 1 root root 22 Sep 30 13:58 /etc/grub2.cfg -> ../boot/grub2/grub.cfg

rpm -q kernel kernel-3.10.0-327.el7.x86_64 kernel-3.10.0-514.10.2.el7.x86_64 kernel-3.10.0-862.14.4.el7.x86_64

uname -r 3.10.0-514.10.2.el7.x86_64

awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg 0 : Red Hat Enterprise Linux Server (3.10.0-862.14.4.el7.x86_64) 7.3 (Maipo) 1 : Red Hat Enterprise Linux Server (0-rescue-cc1932fbd038443f9c0cda7153d87e9e) 7.3 (Maipo)

`````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

Hi Majid,

Please give us the output from ls -l /boot/grub2 - thank you. :)

Regards,
Christian

Hi Christian ls -l /boot/grub2/ total 12 -rw-r--r--. 1 root root 4574 Sep 30 14:35 grub.cfg -rw-r--r--. 1 root root 1024 Sep 30 14:52 grubenv

Thanks Majid, as you can see the grub.cfg file exists and resides in the correct location. Now please execute sudo grub2-mkconfig -o /boot/grub2/grub.cfg and reboot the system ... you should boot with the new kernel 3.10.0-862.14.4.el7.x86_64. :)

Regards,
Christian

Yes Majid,

The file 'grub.cfg' is there as rightly pointed out when you run 'ls -l /etc/grub2.cfg' command, but the location where you searching this file is not the correct one. It is under /boot/grub2 location.

As per the "rpm -q kernel" command it shows that there 3 kernels installed, however, "ls /boot" command only shows "vmlinuz-3.10.0-862.14.4.el7.x86_64", there is something seriously incorrect over there.

Also, the file /boot/grub2/grubenv shows which menuentry the system would boots into as shown in case of my system:

[root@ansiblehost ~]# cat /boot/grub2/grubenv |grep saved
saved_entry=0

So, my further questions:

  • Have you rebooted the system after new kernel installation?

  • Was there any error reported during previous kernel upgrade?

  • Depending on number of kernels installed, there should be matching initramfs, vmlinuz, System-map, symvers files present for each kernel loaded. But not seen in your case??? Were those files removed???

  • Also, run this command and send the output:

# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/grub2/grub.cfg

It looks to me that we could set the grub-default using the command "grub2-set-default 0" which is by default set, and shown when we run "cat /boot/grub2/grubenv" which is not showing in your case. However, before that you could send the details as requested....

Hi Sadashiv Yes , i have rebooted the system multiple times No error reported Depending on number of kernels installed, there should be matching initramfs, vmlinuz, System-map, symvers files present for each kernel loaded. But not seen in your case??? Were those files removed??? I am not sure, i recreated the grub2 with grub2-config after updating kernel ? does this remove the other kernel files? awk -F\' '$1=="menuentry " {print i++ " : " $2}' /boot/grub2/grub.cfg 0 : Red Hat Enterprise Linux Server (3.10.0-862.14.4.el7.x86_64) 7.3 (Maipo) 1 : Red Hat Enterprise Linux Server (0-rescue-cc1932fbd038443f9c0cda7153d87e9e) 7.3 (Maipo)

cat /boot/grub2/grubenv |grep saved

saved_entry=0

Majid, if everything we suggested fails, please reinstall the new kernel 3.10.0-862.14.4.el7.x86_64 :
sudo yum reinstall kernel* and reboot the system afterwards, hope it solves the problem. :)

Regards,
Christian

The grubenv output looks correct. Does "uname -r" still shows older kernel?

I have another idea, Majid - is it possible that you explicitly set the old kernel as default to boot some time ago and forgot about it ? :)

Regards,
Christian

Yes Majid. As Christian said you may try to re-install the new kernel using the command "yum reinstall kernel-3.10.0-862.14.4.el7.x86_64" (this may not work if running kernel is the same one). After the reinstall reboot the system and check if the running kernel is the latest one. Since the re-installed kernel would be become the default one. Also, I request to format command outputs as we do and post it, so that it would be easier to read.

I just tried to re-installing earlier kernel as pasted below which made it as the default kernel after the reboot:

[root@ansiblehost ~]# grep "menuentry 'Red Hat Enterprise Linux Server (3" /boot/grub2/grub.cfg
menuentry 'Red Hat Enterprise Linux Server (3.10.0-693.el7.x86_64) 7.4 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.el7.x86_64-advanced-c7565712-5c4b-4531-a99e-2ee14a979fd6' {
menuentry 'Red Hat Enterprise Linux Server (3.10.0-862.14.4.el7.x86_64) 7.4 (Maipo)' --class red --class gnu-linux --class gnu --class os --unrestricted $menuentry_id_option 'gnulinux-3.10.0-693.el7.x86_64-advanced-c7565712-5c4b-4531-a99e-2ee14a979fd6' {

[root@ansiblehost ~]# grep saved /boot/grub2/grubenv
saved_entry=Red Hat Enterprise Linux Server (3.10.0-693.el7.x86_64) 7.4 (Maipo)

[root@ansiblehost ~]# grep -i default /etc/default/grub
GRUB_DEFAULT=saved

[root@ansiblehost ~]# uname -r
3.10.0-693.el7.x86_64

Not sure if we've helped to fix the issue. Majid, by the way, you may log case with Red Hat Support Team if you've support contract and also update us how the issue got fixed, so that it would help the community as well.........

That's a good point Sadashiva ... so yes, please tell us which solution (in case it did) solved your problem, Majid. :)

Regards,
Christian

Anyone who happens to arrive at this discussion wishing to determine if their system actually is UEFI or BIOS, here's a script...

#!/bin/bash
[ -d /sys/firmware/efi ] && fw="UEFI" || fw="BIOS"
echo -e "$fw"
if [ "$fw" == "UEFI" ] ; then
        mygrub='/boot/efi/EFI/redhat/grub.cfg'  
        echo -e "\n\tUEFI detected, this is a ($fw) system., and the boot config is located at ($mygrub)"
    else
        mygrub='/boot/grub2/grub.cfg'
        echo -e "\n\t($fw) system detected your boot config is located at ($mygrub)\n"
fi

If it's BIOS, the script will output: /boot/grub2/grub.cfg else, it will be /boot/efi/EFI/redhat/grub.cfg. It is worthwhile to check

Regards,

RJ

That's a nice one RJ. Thank you.. :)

Hey RJ, my friend - " ... wishing to determine if their system actually is UEFI or BIOS"
Is this another example of your "unbelievable, unbeatable sense of humor" ? :D :D :D
Do you also have a script which lets us determine whether it is a computer or a TV ?
Joke aside - thank you for creating and sharing your script, it may be helpful indeed.

Cheers :)
Christian

Dear All, Thanks for your effort. I have logged a case with Red hat support and we solved the problem For some strange reason, in /etc/fstab /boot was commented out

Dear All, Thanks for your effort. I have logged a case with Red hat support and we solved the problem For some strange reason, in /etc/fstab /boot was commented out

You're welcome, Majid ! :) Thanks for the information - I'm glad to read that you could sort things out. :)

Regards,
Christian

Yeah, that is odd and a learning for us. Anyways, it is nice that the problem is resolved now.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.