Return to Level1Techs.com

[SOLVED] Grub not respecting the default entry

I switched from ext4 to btrfs on my manjaro efi system, and I keep getting the “error: sparse file not allowed” message on every boot. The system still manages to boot up, and I can choose the system I want to boot to, but for some reason the default entry it picks is the second one (windows) instead of the first one (linux). My GRUB_DEFAULT is set to 0, so it should be picking Manjaro by default, but no luck there (it also picks windows when I set the default to manjaro by name).
Has anyone experienced this before?
From researching this issue around on the internet, I’ve concluded that the error message pops up because grub can’t write to grub, but it should still be able to read, right?

I was using grub-reboot in order to boot into windows from linux. After running my script once, it kept consistently booting into windows by default. As it turns out, that is expected behavior. From the grub-reboot man:

NOTE: In cases where GRUB cannot write to the environment block, such as when it is stored on an MDRAID or LVM device, the chosen boot menu entry will remain the default even after reboot.

So, I guess that because it can’t write, it can’t remember that it did successfully pull off the “one time boot”, and it keeps doing it over and over again. It’s kinda annoying, but now that I know what the issue is, I will find some way around it.

Edit: I found a good solution here (moving boot onto the efi partition): GRUBENV error when using BTRFS - #4 by Chrysostomus - Installation & Boot - Manjaro Linux Forum

The answer came from TriMoon, and my “modified” explanation is below:

  1. Start a livecd environment.
  2. Mount your root partition somewhere.
  3. Create an efi dir inside of that mounted root, and mount your efi partition there.
  4. manjaro-chroot into the mounted root (fiddle around with chroot if you are on another distro).
  5. Make an EBoot dir inside of /efi.
  6. Move everything from /boot into /efi/EBoot
  7. Bind-mount the /efi/EBoot directory as /boot eg:
    mount -o bind /efi/EBoot /boot
    And this in /etc/fstab:
/efi/EBoot   /boot   none    bind
  1. Also edit your fstab, and change /boot/efi to /efi.
  2. rmdir /boot/efi
  3. Re-install grub with grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=manjaro --recheck
    grub-mkconfig -o /boot/grub/grub.cfg
  4. Reboot, and you are good to go
2 Likes

Pretty much if you are using any non-standard FS on linux and you have uEFI support on your mobo, you should be doing this.

With that said, the only way around this is to ensure that your driver for your FS is packaged in your initrd/initramfs and that you know what the id of the boot drive is.