Bug 1217089

Summary: grub2: grubenv env_block on btrfs gets wiped out
Product: [openSUSE] openSUSE Tumbleweed Reporter: Tilman Vogel <tilman.vogel>
Component: BootloaderAssignee: Bootloader Maintainers <bootloader-maintainers>
Status: NEW --- QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None    
Version: Current   
Target Milestone: ---   
Hardware: x86-64   
OS: openSUSE Tumbleweed   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---

Description Tilman Vogel 2023-11-13 14:37:25 UTC
User-Agent:       Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0
Build Identifier: 

I had the "invalid environment block" message shown by grub2 for quite a while. Then, I reset the environment block using the method that I lately documented here: https://en.opensuse.org/GRUB#Recovering_from_broken_grubenv
After that, GRUB_SAVEDEFAULT worked just fine.
After a few days and I cannot tell you why, the "invalid environment block" message is back and looking at the env_block using

dd if=/dev/yourbootpartition bs=512 skip=512 count=1 | xxd

shows me that the block has been completely wiped out by zeroes.

So, I wonder, what might have the audacity to wipe out that block. Is my btrfs set up incorrectly? Do I have to reserve that block somehow?




Reproducible: Sometimes

Steps to Reproduce:
1. Reset grubenv env_block on btrfs /boot partition
2. NO IDEA WHAT CAUSES THIS
3. Again get "invalid environment block".

Actual Results:  
"invalid environment block" error message and blanked out env_block.

Expected Results:  
No error from grub2 and env_block still containing the grubenv signature:

# dd if=/dev/nvme0n1p5 bs=512 skip=512 count=1 | xxd
1+0 Datensätze ein
1+0 Datensätze aus
512 Bytes kopiert, 0.000136221 s, 3.8 MB/s
00000000: 2320 4752 5542 2045 6e76 6972 6f6e 6d65  # GRUB Environme
00000010: 6e74 2042 6c6f 636b 0a23 2323 2323 2323  nt Block.#######
00000020: 2323 2323 2323 2323 2323 2323 2323 2323  ################
00000030: 2323 2323 2323 2323 2323 2323 2323 2323  ################
00000040: 2323 2323 2323 2323 2323 2323 2323 2323  ################
...