System boots into Older kernel due to stale machine-id in /boot/loader/entries
Environment
- Red Hat Enterprise Linux 8 and later
Issue
- The system unexpectedly boots into an older kernel by default, even though newer kernel versions are installed and available in
/boot.
Resolution
Before applying any changes, ensure that the Diagnostics Steps confirm the issue on the system.
-
Clean up stale entries:
# mkdir /tmp/stale-entries # mv /boot/loader/entries/<OLD_MACHINE_ID>* /tmp/stale-entries/ -
(Optional) If needed, copy and rename any required entry to match the current
machine-id:# cp /tmp/stale-entries/<OLD_MACHINE_ID>-<KERNEL>.conf /boot/loader/entries/<CURRENT_MACHINE_ID>-<KERNEL>.conf -
Make sure the default is now pointing to a valid entry using current
machine-id:# grubby --default-kernel
Root Cause
-
Each kernel boot entry under
/boot/loader/entries/follows this naming convention:<MACHINE-ID>-<KERNEL-VERSION>.conf
If the system has been reinstalled, cloned, or restored from an image, the machine-id found in /etc/machine-id may change. However, older boot entries linked to the previous machine-id may remain in /boot/loader/entries/.
- Tools like grubby do not prioritize the highest kernel version automatically. Instead, they rely on the order and index of boot entries, even if those entries are from a different (stale)
machine-id. This can cause the system to boot into an older kernel by default.
Diagnostic Steps
To determine if this issue applies to your system:
-
Get current
machine-id:# cat /etc/machine-id -
List all boot entries:
# ls -l /boot/loader/entries/ -
Check for multiple sets of entries with different
machine-id. -
Inspect the output of:
# grubby --info=ALL -
Look for entries associated with stale
machine-idshowing a lower index or being marked as the default.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.