Newest installed kernel not in use
If the newest installed kernel is not in use even after rebooting, it typically means your system is booting into an older kernel version. This happens due to the default GRUB settings or other configuration issues.
Here’s how you can resolve the issue step-by-step:
1. Verify the Currently Running Kernel
- Check the kernel currently in use:
uname -r
- Example output:
CopyEdit
3.10.0-1127.el7.x86_64
- Compare this with the newest installed kernel version (see step 2).
2. List All Installed Kernels
- List all installed kernel packages:
rpm -qa | grep kernel | grep -v firmware
- Example output:
kernel-3.10.0-1127.el7.x86_64
kernel-3.10.0-1160.el7.x86_64
- Identify the newest kernel (e.g., 3.10.0-1160.el7.x86_64).
3. Check GRUB Default Boot Entry
- Display the current GRUB default boot entry:
grub2-editenv list
- You should see something like this:
saved_entry=0
- If the saved_entry is pointing to an older kernel, the system is booting into it by default.
4. Update GRUB to Use the Newest Kernel
Option A: Use the First Kernel (Default GRUB Behavior)
- Edit the GRUB configuration:
sudo vi /etc/default/grub
- Set the GRUB_DEFAULT value to 0 (the first kernel in the GRUB list):
GRUB_DEFAULT=0
- Save and exit the file.
- Regenerate the GRUB configuration:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
Option B: Manually Specify the Newest Kernel
- Run this command to view all available kernel entries:
awk -F\’ ‘$1==”menuentry ” {print i++ ” : ” $2}’ /boot/grub2/grub.cfg
- Example output:
0 : CentOS Linux (3.10.0-1160.el7.x86_64)
1 : CentOS Linux (3.10.0-1127.el7.x86_64)
2 : CentOS Linux (0-rescue-…)
- Set GRUB_DEFAULT to the corresponding entry for the newest kernel (e.g., 0):
sudo grub2-set-default 0
- Verify the setting:
grub2-editenv list
5. Reboot the System
- Reboot your system to load the correct kernel:
sudo reboot
- After reboot, confirm that the new kernel is in use:
uname -r
6. Remove Old Kernels (Optional)
- To prevent confusion in the future, you can remove unused older kernels:
sudo package-cleanup –oldkernels –count=1
- This retains only the most recent kernel.
7. Troubleshooting
- Manually Select the Kernel: If the system still boots into the wrong kernel, you can manually select the desired kernel during the GRUB menu at boot time. To enable the GRUB menu:
- Edit /etc/default/grub:
sudo vi /etc/default/grub
- Set GRUB_TIMEOUT to a non-zero value (e.g., 5):
GRUB_TIMEOUT=5
- Save and regenerate the GRUB configuration:
sudo grub2-mkconfig -o /boot/grub2/grub.cfg
- Kernel Missing After Update: Ensure the new kernel is properly installed. Reinstall it if necessary:
sudo yum install kernel