Yum update kernel does not boot into new kernel and /boot/grub2/grub.config is not existing
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 shimsudo 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.
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....
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.........
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
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
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
