Thank you for supporting the Cloud Customer Connect Community in 2024. It's a gift to work with you!

Look back
You're almost there! Please answer a few more questions for access to the Applications content. Complete registration
Interested in joining? Complete your registration by providing Areas of Interest here. Register

OCI : Grubby commands fail with error "/usr/bin/grub2-editenv: error: invalid environment block"

edited Jul 11, 2024 4:45AM in Linux

Applies to:

Oracle Cloud Infrastructure - Version N/A and later

Linux x86-64

Oracle Linux 8 – Oracle Linux 9

Symptoms:

Failed to change the default kernel

[root@xxxx ~]# grubby --set-default "/boot/vmlinuz-5.15.0-208.159.3.el8uek.x86_64"
grub2-editenv: error: invalid environment block.
The default is /boot/loader/entries/c20b6092d8ce4c58832f6d822e93dcec-5.15.0-208.159.3.el8uek.x86_64.conf with index 2 and kernel /boot/vmlinuz-5.15.0-208.159.3.el8uek.x86_64

Cause:

The file /boot/grub2/grubenv is either corrupted or not exactly 1024B (1K) in size.

Solution:

Confirm that grubenv file is pointing to the proper location

ls -l /boot/grub2/grubenv

Howdy, Stranger!

Log In

To view full details, sign in.

Register

Don't have an account? Click here to get started!