OL9.9 grub2-common-2.06-134.0.1: 20-grub.install ignores DEFAULTKERNEL — installing RHCK steals the default from UEK

Aperta Adatta ai principianti
#233 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
bash, linux, shell

Direzione di ricerca

Inizia confrontando /usr/lib/kernel/install.d/20-grub.install tra le versioni 2.06-127.0.1 e 2.06-134.0.1, concentrandoti su DEFAULTKERNEL e KERNEL_NAME. Segui come tmp_saved_entry viene promosso in 95-set-boot-entry.install, quindi controlla i test pertinenti del pacchetto, se presenti. L’obiettivo è raggiunto quando l’installazione di RHCK con DEFAULTKERNEL=kernel-uek-core lascia la voce di avvio UEK come predefinita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Environment

  • Oracle Linux 9.9, x86_64 (bare metal, BLS, GRUB_ENABLE_BLSCFG=true)
  • grub2-common-2.06-134.0.1.el9 (upgraded from 2.06-127.0.1.el9_8)
  • /etc/sysconfig/kernel: UPDATEDEFAULT=yes, DEFAULTKERNEL=kernel-uek-core
  • Both UEK (kernel-uek-core-5.15.0-326.224.5.1.el9uek) and RHCK (kernel-core) installed

What happened
A routine dnf-automatic update (9.8 → 9.9) installed kernel-core-5.14.0-741.20.1.el9_9 together with
grub2-*-2.06-134.0.1. After the reboot the system came up on RHCK 5.14.0-741.20.1.el9_9 instead of UEK;
grub2-editenv list shows saved_entry=<machine-id>-5.14.0-741.20.1.el9_9.x86_64.

Earlier RHCK updates on the same host (kernel-core-5.14.0-687.60.1/.61.1/.65.1/.66.1, all installed while
grub2 2.06-127.0.1 was present) did NOT change the default — the system stayed on UEK.

Root cause
/usr/lib/kernel/install.d/20-grub.install lost Oracle's DEFAULTKERNEL guard (Orabug 30643497,
"honor /etc/sysconfig/kernel DEFAULTKERNEL setting for BLS") when it was rebased onto Red Hat's 2.06-130 change
"Wait for initramfs and kernel to be installed before set default kernel" (tmp_saved_entry + 95-set-boot-entry.install):

--- 2.06-127.0.1.el9_8  20-grub.install
+++ 2.06-134.0.1.el9    20-grub.install
@@ -159,2 +159,2 @@
-            if [ -n "$NEWDEFAULT" ] && [ "$DEFAULTKERNEL" = "$KERNEL_NAME" ]; then
-                grub2-editenv - set "saved_entry=${NEWDEFAULT}"
+            if [ -n "$NEWDEFAULT" ]; then
+                grub2-editenv - set "tmp_saved_entry=${NEWDEFAULT}"

KERNEL_NAME is still computed but no longer used. 95-set-boot-entry.install then promotes
tmp_saved_entry to saved_entry unconditionally, so any newly installed kernel (RHCK included) becomes the
default. The 2.06-134.0.1 changelog still lists the Orabug 30643497 patch.

Expected
With DEFAULTKERNEL=kernel-uek-core, installing/updating RHCK must not change the default boot entry
(as with 2.06-127.0.1, and as documented: updates keep the installed kernel type).

Suggested fix
Restore the guard on the new line:

if [ -n "$NEWDEFAULT" ] && [ "$DEFAULTKERNEL" = "$KERNEL_NAME" ]; then
    grub2-editenv - set "tmp_saved_entry=${NEWDEFAULT}"

Reproduce

  1. OL9 with UEK default, DEFAULTKERNEL=kernel-uek-core, grub2-common-2.06-134.0.1.
  2. dnf install kernel-core-<newer RHCK> (or dnf reinstall).
  3. grubby --default-kernel → now the RHCK image.

Workaround
grubby --set-default /boot/vmlinuz-<uek-version> after each RHCK update, or exclude RHCK from updates.

Lingua principale
Shell
Stelle
180
Fork
52
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di oracle/oracle-linux

Tutte le issue di oracle/oracle-linux

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.