Bug 2095363 - Grub2 GRUB_SAVEDEFAULT fails with btrfs boot partition with the error "sparse file not allowed"
Summary: Grub2 GRUB_SAVEDEFAULT fails with btrfs boot partition with the error "sparse...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 40
Hardware: All
OS: All
unspecified
medium
Target Milestone: ---
Assignee: Nicolas Frayer
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-09 16:21 UTC by Saulo Toledo
Modified: 2024-02-15 22:55 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-25 18:05:08 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Saulo Toledo 2022-06-09 16:21:04 UTC
Description of problem:
If you have /boot in btrfs and set GRUB_SAVEDEFAULT=true, grub2 will fail with:

error: ../../grub-core/commands/loadenv.c:2016:sparse file not allowed
press any key to continue booting

In my setup, I have an UEFI boot. I do not know if this affect non-UEFI setups.

Version-Release number of selected component (if applicable):
2.06-40

How reproducible:
Always, if you have the described setup.


Steps to Reproduce:
1. Setup a UEFI boot (I am not sure whether this step is necessary)
2. Create and properly mount a /boot partition with btrfs as file system (the issue seems to be related to limitations with btrfs).
3. Add GRUB_SAVEDEFAULT=true to /etc/default/grub
4. Run "grub2-mkconfig -o /boot/grub2/grub.cfg" as root
5. Restart your computer
6. Try to boot your OS. 


Actual results:
The "savedefault" functionality will not work and the error can be seen

Expected results:
No error messages and the "savedefault" functionality working.

Additional info:
The bug seems to be old. See, for example, this report for Fedora 34 with no resolution: https://bugzilla.redhat.com/show_bug.cgi?id=2023055

The issue seems to affect other distributions. See, for example: https://archived.forum.manjaro.org/t/solved-grub-btrfs-error-sparse-file-not-allowed/70031/9

One possible workaround is to use a non-btrfs partition for /boot.

I do not have enough experience with grub, but I was wondering if one of the maintainers could find a workaround by editing, for example, /etc/grub.d/00_header

If grub2 does not support btrfs, the Fedora setup should at least show a warning that it is not advisable to use btrfs in a partition with /boot.

Comment 1 Fedora Admin user for bugzilla script actions 2023-02-02 00:13:41 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 2 Fedora Admin user for bugzilla script actions 2023-04-25 00:11:08 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 3 Ben Cotton 2023-04-25 17:23:41 UTC
This message is a reminder that Fedora Linux 36 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 36 on 2023-05-16.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '36'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 36 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 4 Ludek Smid 2023-05-25 18:05:08 UTC
Fedora Linux 36 entered end-of-life (EOL) status on 2023-05-16.

Fedora Linux 36 is no longer maintained, which means that it
will not receive any further security or bug fix updates. As a result we
are closing this bug.

If you can reproduce this bug against a currently maintained version of Fedora Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 5 Petr Menšík 2023-12-05 21:48:58 UTC
Sadly this is still a problem and has no simple workaround, since Fedora installation defaults to everything installed into btrfs / partition. Separate ext4 /boot would help, but that is difficult to do on already deployed system.

Comment 6 Aoife Moloney 2024-02-15 22:55:08 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.


Note You need to log in before you can comment on or make changes to this bug.