Kernel reinstall - grub now boots older kernel

Issues related to applications and software problems and general support
Post Reply
lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Kernel reinstall - grub now boots older kernel

Post by lightman47 » 2023/09/24 18:42:29

RHEL 8.8 - after weekly update on 9-19-23

Uncharacteristically, the auto Tuesday update apparently suffered a bad install but I didn't find out until I shut down my laptop that night. During the shutdown, the text screen messages changed to a large font, the process also stalled for a time.

Boot-up Wednesday morning in the new kernel - started ok, but went sour very early on after selecting the default new kernel, complaining about not finding a UEFI file, and all network stuff failed as well. The Gnome GUI started fine, but as expected - no networking. Since then, I made sure to boot the previous kernel - which worked fine.

{That was the history}

Yesterday, (from the previous kernel), I reinstalled kernel *.*; it went successfully. I then rebooted and all kernels work. My issue is that now, all the kernels (and debug installations} list properly, but it defaults the oldest kernel (index 5). I have to catch it and manually select the newest kernel (index 1).

/etc/default/grub is set to 'saved'
I've run gru2-mkconfig multiple times {grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg)
Experimenting with grubby, it confirms the default is indeed 5.

I am trying to get the default boot back to the automatic/normal latest kernel:

Code: Select all

Linux ldellg3.????? 4.18.0-477.27.1.el8_8.x86_64 #1 SMP Thu Aug 31 10:29:22 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux
I'd appreciate insight.

Thank you.

User avatar
jlehtone
Posts: 4538
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Kernel reinstall - grub now boots older kernel

Post by jlehtone » 2023/09/25 08:23:27

What the grub2-mkconfig writes does depend on the content of /etc/default/grub,
but grub has also "environment" that you can see with:
grub2-editenv list

The grubby can apparently do edits too: https://access.redhat.com/documentation ... -boot-menu

User avatar
TrevorH
Site Admin
Posts: 33232
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Kernel reinstall - grub now boots older kernel

Post by TrevorH » 2023/09/25 09:38:26

Yesterday, (from the previous kernel), I reinstalled kernel *.*
I'd point out that this isn't the wisest thing to do if you have kernel problems as it will change all the existing and still working kernels and potentially break them in the same way that the new one is.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Kernel reinstall - grub now boots older kernel

Post by lightman47 » 2023/09/25 09:41:43

I had seen that page in the manual but was hesitant to change the index for fear it would change the default in /etc/default/grub, thereby 'hard-coding' a specific kernel. That did not happen!!

I got brave and did:

Code: Select all

sudo grubby --set-default-index=1
- all is right with the world.

Thank you!!!

lightman47
Posts: 1522
Joined: 2014/05/21 20:16:00
Location: Central New York, USA

Re: Kernel reinstall - grub now boots older kernel

Post by lightman47 » 2023/09/25 09:44:52

I'd point out that this isn't the wisest thing to do if you have kernel problems as it will change all the existing and still working kernels and potentially break them in the same way that the new one is.
It was a shot in the dark move! The other alternatives seemed to be 1. leave it alone or 2. re-instal.

Thank you all.

User avatar
jlehtone
Posts: 4538
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Kernel reinstall - grub now boots older kernel

Post by jlehtone » 2023/09/25 10:47:06

lightman47 wrote:
2023/09/25 09:44:52
It was a shot in the dark move! The other alternatives seemed to be 1. leave it alone or 2. re-instal.
When one has a kernel installed that "does not work", one obviously is not running that kernel and can therefore
remove and install that specific kernel. (Or reinstall.)

You can list installed kernels with:
dnf rq --installonly
Just the latest of them:
dnf rq --installonly --latest=1
All but the latest:
dnf rq --installonly --latest=-1

You can state explicit version for each package that you want to remove/install/reinstall.
E.g. dnf install kernel-4.18.0-477.27.1.el8_8

Note those are the "installonly" packages that one can have more than one simultaneously while most packages, including some kernel subpackages, "there can be only one".

Post Reply