Menu

Parallel GRUB installations - and going back to rEFInd from GRUB

2023-11-09
2023-11-27
  • R.J.V. Bertin

    R.J.V. Bertin - 2023-11-09

    Hi,

    I have an old Ubuntu set-up with a root-on-ZFS main fs, /boot on an ext4 partition; GPT partition scheme with an EFI and a "GPT Boot Partition" in a laptop with UEFI support. GRUB has also been installed to the disk's MBR so normally I don't get into rEFInd.

    At some point I tested a few BSD versions on other partitions of the disk, which I booted into through raw disk access in VirtualBox (only to the required partitions of course).

    This worked, but now I've decided I wanted another ZFS pool + dedicated boot partition for an up-to-date Devuan install which I already prepared on an external disk and rsync'ed to the new pool (and boot partition).

    My plan was to copy my existing EFI\ubuntu directory to EFI\Devuan and change the grub.cfg in that new directory so that both installs can maintain their own grub.cfg file independently. I also planned to add a stanza to each grub.cfg to escape back to (chainload) rEFInd.

    To test this, I created a rawdisk VMDK that gives a VM access to the EFI partition, the new boot partition and the new ZFS pool. So not the "GPT Boot Partition" (which I understand holds the MBR bootloader) and none of those partitions is mounted by the host when I run the VM, evidently. I also disable the "hdbios" scan option.

    The VM sees rEFInd just fine (need to launch it manually for now), and rEFInd does see the Ubuntu and Devuan GRUB options. However:

    • I'm still seeing an old BSD boot option, which shouldn't happen because they no longer exist on disk and I removed the manual menu entry in refind.conf
    • Regardless of which GRUB option I choose, I alway end up in the Ubuntu GRUB configuration
    • chainloading rEFInd just gives me a black screen. BTW: I did NOT install the new Ubuntu GRUB to the MBR so the fact that I do get the rEFInd option means that I do NOT end up in the MBR bootloader (= as intended).

    This is the chainload stanza I handcoded:

    menuentry "Launch rEFInd" {
        insmod part_gpt
        insmod chain
        set root='hd0,gpt1'
        if [ x$feature_platform_search_hint = xy ]; then
          search --no-floppy --fs-uuid --set=root --hint-ieee1275='ieee1275//disk@0,gpt1' --hint-bios=hd0,gpt1 --hint-efi=hd0,gpt1 --hint-baremetal=ahci0,gpt1  9C80-0915
        else
          search --no-floppy --fs-uuid --set=root 9C80-0915
        fi
        chainloader /EFI/BOOT/bootx64.efi
    }
    

    Two main questions:
    - is it possible to select between 2 different GRUB configurations like I'm trying to, and if so, what am I doing wrong?
    - what am I doing wrong with the rEFInd launching from GRUB?

    Thanks!
    R.

     
  • R.J.V. Bertin

    R.J.V. Bertin - 2023-11-10

    To answer my 1st question myself: EFI/ubuntu/grubx64.efi expects the grub.cfg file in EFI/ubuntu, so making a copy of that directory as I did will give the effect I observed. Fortunately Debian (and thus Devuan) have their own version that expects grub.cfg in EFI/debian

    Maybe my 2nd question should if
    - Is it possible to launch rEFInd from grub (and if so, how)?

     
  • Chauncy

    Chauncy - 2023-11-27
    menuentry "Back to rEFInd" {
        insmod minicmd
        exit
    }
    
     

    Last edit: Chauncy 2023-11-27
    • R.J.V. Bertin

      R.J.V. Bertin - 2023-11-27

      Chauncy wrote on 20231127::05:15:31 re: "[refind:discussion] Parallel GRUB installations - and going back to rEFInd from GRUB"

      menuentry "Launch rEFInd" {
      insmod minicmd
      exit
      }

      Wow, that's just too easy, thanks!

      R.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.