Skip to content

Default boot entry is not preserved because grubenv is removed during recovery #3578

@svlv

Description

@svlv

ReaR version

2.9

Describe the ReaR bug in detail

Hi!

I've experienced an issue with missing the saved boot entry after recovery on Rocky 9, which was upgraded from version 9.6 to 9.7 . The original system uses the latest installed kernel, but after recovery it uses the the first boot entry from /boot/loader/entries/* in alphabetical order.

Before recovery

  1. Current kernel version
$ uname -r
5.14.0-611.34.1.el9_7.x86_64
  1. Default boot entry - it is the latest kernel version on this system
$ sudo grubby --info=DEFAULT
index=2
kernel="/boot/vmlinuz-5.14.0-611.34.1.el9_7.x86_64"
args="rootdelay=300 console=ttyS0 earlyprintk=ttyS0 no_timer_check net.ifnames=0 crashkernel=1G-2G:192M,2G-64G:256M,64G-:512M"
root="UUID=8fac9486-4a35-45c8-9712-9c66ddc261eb"
initrd="/boot/initramfs-5.14.0-611.34.1.el9_7.x86_64.img"
title="Rocky Linux (5.14.0-611.34.1.el9_7.x86_64) 9.7 (Blue Onyx)"
id="5cf83cd1296b4ba88f9fc7e574b990f8-5.14.0-611.34.1.el9_7.x86_64"
  1. saved_entry in /boot/grub2/grubenv contains the latest kernel version. It is how it is saved and used by GRUB.
$ sudo cat /boot/grub2/grubenv
# GRUB Environment Block
# WARNING: Do not edit this file by tools other than grub-editenv!!!
boot_success=1
boot_indeterminate=0
saved_entry=5cf83cd1296b4ba88f9fc7e574b990f8-5.14.0-611.34.1.el9_7.x86_64

After recovery

  1. Current kernel version has been changed
$ uname -r
5.14.0-570.17.1.el9_6.x86_64
  1. The default boot entry has been changed. Now, it is just the first boot entry
$ sudo grubby --info=DEFAULT
index=0
kernel="/boot/vmlinuz-5.14.0-570.17.1.el9_6.x86_64"
args="rootdelay=300 console=ttyS0 earlyprintk=ttyS0 no_timer_check net.ifnames=0 crashkernel=1G-2G:192M,2G-64G:256M,64G-:512M"
root="UUID=8fac9486-4a35-45c8-9712-9c66ddc261eb"
initrd="/boot/initramfs-5.14.0-570.17.1.el9_6.x86_64.img"
title="Rocky Linux (5.14.0-570.17.1.el9_6.x86_64) 9.6 (Blue Onyx)"
id="26599199cb4a4d3db754be754593c5b0-5.14.0-570.17.1.el9_6.x86_64"
  1. The root cause - saved_entry is no longer set in /boot/grub2/grubenv
$ sudo cat /boot/grub2/grubenv
# GRUB Environment Block
# WARNING: Do not edit this file by tools other than grub-editenv!!!
boot_indeterminate=2
boot_success=1

Platform

No response

OS version

Rocky Linux 9.7

Backup

No response

Storage layout

No response

What steps will reproduce the bug?

No response

Workaround, if any

Set BACKUP_RESTORE_MOVE_AWAY_FILES=( ) in local.conf

Additional information

Likely all systems using saved_entry in grubenv are affected.
However, systems that use grubenv from /boot/efi/EFI/*/grubenv are safe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions