Error grub sparse file not allowed

Have just cloned a 500gb drive to a 1tb drive.
All appears to be working fine, except:
On boot, grub gives me the message (on selection of ANY OS):

error: ../../grub-core/commands/loadenv.c:289:sparse file not allowed.
Loading linux 6.1.8-1-default ...
Loading initial ramdisk ...
Press any key to continue...

Have googled, and looks like there isn’t really any fix without reinstalling Tumbleweed.
Is there? :thinking:

I’m not sure, but you may only need to reinstall grub.

You may boot some openSUSE-Tumbleweed-NET-x86_64-Snapshot20230127-Media.iso and start the OS on disk from netinstall grub.

Can start Tumbleweed OK, but can’t setup the Default=saved for grub - not a major issue…
Apparently a reinstall of Tumbleweed, or a separate /boot partition - doesn’t like btrfs…

I am only guessing. I suspect that the file it is complaining about is “/boot/grub2/grubenv”.

I would try (as root):

cd /boot/grub2
mv grubenv grubenv.old
cp grubenv.old grubenv

and see if that makes it a regular (non-sparse) file. If that works to solve your problem, you can then remove that “grubenv.old”.

Show as root

stat -f -c %T /boot/grub2/grubenv
grub2-editenv - list
grep -Ev '^(#.*| *)$' /etc/default/grub

What exactly does it mean?

Nope, no change…

boss:/boot/grub2 # stat -f -c %T /boot/grub2/grubenv
btrfs

boss:/boot/grub2 # grub2-editenv  - list
(nothing....)

boss:/boot/grub2 # grep -Ev '^(#.*| *)$' /etc/default/grub
GRUB_DISTRIBUTOR=
GRUB_DEFAULT=saved
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=8
GRUB_CMDLINE_LINUX_DEFAULT="splash=silent quiet security=apparmor net.ifnames=0 mitigations=auto"
GRUB_CMDLINE_LINUX=""
GRUB_SAVEDEFAULT="true"
GRUB_TERMINAL="gfxterm"
GRUB_GFXMODE="auto"
GRUB_BACKGROUND=
GRUB_THEME=/boot/grub2/themes/openSUSE/theme.txt
SUSE_BTRFS_SNAPSHOT_BOOTING="true"
GRUB_USE_LINUXEFI="true"
GRUB_DISABLE_OS_PROBER="false"
GRUB_ENABLE_CRYPTODISK="n"
GRUB_CMDLINE_XEN_DEFAULT="vga=gfx-1024x768x16"

Saves the last booted item, so on a reboot, will start that option…

And, as I said, if set to boot one of the options - works fine. Is only when I set the default=saved

Thanks.

OK. Bit more of interest after a bit of reading…
Apparently, if /boot is BTRFS, the savedefault stuff should NEVER work…
I have been using savedefault+btrfs for several years (at least?), and has always worked perfectly.
The ONLY reason it has stopped is I cloned the original hard drive to a new one, but BTRFS was being used on both…
Beats me!
Thanks.

I know what GRUB_DEFAULT=saved does (and you spelled it wrong anyway) and it does not do what you describe and should not cause this error. I asked what “can’t setup” means - what you did, what results you observed.

Run

grub2-editenv - set next_entry=0
grub2-editenv - unset next_entry
grub2-editenv - list

and post full output.

??

Can’t setup means setting:

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT="true"

in /etc/default/grub, and running sudo grub2-mkconfig -o /boot/grub2/grub.cfg
does not work - always boots option 0

boss:/home/john # grub2-editenv - set next_entry=0
boss:/home/john # grub2-editenv - unset next_entry
boss:/home/john # grub2-editenv - list
env_block=512+1

OK, I expect it should work now.

1 Like

Yep, brilliant!
Thank you.