#142 Default GRUB menu entry doesn't chainload grub.cfg on RAID & Btrfs devices

Open
opened 1 year ago by ThomasPfundt · 1 comments

I am experiencing a specific issue with the current Libreboot GRUB config.

On a home server, I would like to install my system either on an unencrypted mdadm or Btrfs RAID1 so that SSH is accessible upon boot without entering a password.

Unfortunately, the default Libreboot GRUB menu entry seems to be unable to find the system's grub.cfg automatically on either mdadm RAID or Btrfs.

The installation has been done in this case with Debian netinstall and as far as I can tell, it doesn't matter whether GRUB is installed to the MBR or via apt install grub-coreboot later on. The default menu entry will just fail on all found partitions with the error: no cryptodisk module can handle this device. It seems like it's specifically looking for an encrypted partition without even accessing unencrypted ones.

Live USB boot and an unencrypted single drive with default Ext4 partitioning are loading fine.

What's strange is that I can access the installed config by just entering configfile (md/0)/boot/grub/grub.cfg in the command line.

For the time being, I've created a new default entry that does just this, but I'm not entirely happy with this solution and it doesn't allow me to reliably access a Btrfs RAID, because as I understand it, the (ahci#) drive enumeration can change between boots, so that would require a more dynamic solution.

I'm not sure what's going wrong. I've started reading into common GRUB configfile loading fuctions, but it's still a bit obscure to me.

Is there any simple solution for this?

I am experiencing a specific issue with the current Libreboot GRUB config. On a home server, I would like to install my system either on an *unencrypted* mdadm or Btrfs RAID1 so that SSH is accessible upon boot without entering a password. Unfortunately, the default Libreboot GRUB menu entry seems to be unable to find the system's grub.cfg automatically on either mdadm RAID or Btrfs. The installation has been done in this case with Debian netinstall and as far as I can tell, it doesn't matter whether GRUB is installed to the MBR or via `apt install grub-coreboot` later on. The default menu entry will just fail on all found partitions with the `error: no cryptodisk module can handle this device`. It seems like it's specifically looking for an encrypted partition without even accessing unencrypted ones. Live USB boot and an unencrypted single drive with default Ext4 partitioning are loading fine. What's strange is that I can access the installed config by just entering `configfile (md/0)/boot/grub/grub.cfg` in the command line. For the time being, I've created a new default entry that does just this, but I'm not entirely happy with this solution and it doesn't allow me to reliably access a Btrfs RAID, because as I understand it, the (ahci#) drive enumeration can change between boots, so that would require a more dynamic solution. I'm not sure what's going wrong. I've started reading into common GRUB configfile loading fuctions, but it's still a bit obscure to me. Is there any simple solution for this?
Leah Rowe commented 1 year ago
Owner

what type of RAID are you using?

i regularly setup encrypted RAID1 (mostly debian). since grub doesn't write anything, it's perfectly OK to just treat a single drive in the RAID array as a single drive. when linux takes over, it uses the RAID array

i do see this in the config:

    for vol in ${lvmvol} ${raidvol} ; do
        try_user_config "${vol}"
    done

and this:

    set pager=0
    echo -n "Attempting to unlock encrypted volumes"
    for dev in ${ahcidev} ${atadev} ${lvmvol} ${raidvol}; do
        if cryptomount "${dev}" ; then break ; fi
    done
    set pager=1
    echo

    # after cryptomount, lvm volumes might be available
    for vol in ${lvmvol}; do
        try_user_config "${vol}"
    done

also:

leah@unimatrix0:~/Project/lbdev/lbmk/grub/grub-core/disk$ ls -1 *mdraid*
mdraid1x_linux.c
mdraid_linux_be.c
mdraid_linux.c

GRUB has pretty decent support for RAID aswell. For example, I see in mdraid_linux.c the following:

  if (level != 0 && level != 1 && level != 4 &&
      level != 5 && level != 6 && level != 10)
    {
      grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
          "unsupported RAID level: %d", level);
      goto fail;
    }

How to interpret the above: if the RAID level isn't one of the levels in the if brackets, it goes to fail, meaning, it exits.

Looking in the grub config for Libreboot, I don't see anything out of the ordinary. In fact, it's searching for user configs in non-RAID first.

I'm leaving this open, but I don't yet know the answer to your problem. Sorry. Feel free to tweak the grub.cfg yourself, and see if you can get it working.

See:

https://libreboot.org/docs/gnulinux/grub_cbfs.html

what type of RAID are you using? i regularly setup encrypted RAID1 (mostly debian). since grub doesn't write anything, it's perfectly OK to just treat a single drive in the RAID array as a single drive. when linux takes over, it uses the RAID array i do see this in the config: ``` for vol in ${lvmvol} ${raidvol} ; do try_user_config "${vol}" done ``` and this: ``` set pager=0 echo -n "Attempting to unlock encrypted volumes" for dev in ${ahcidev} ${atadev} ${lvmvol} ${raidvol}; do if cryptomount "${dev}" ; then break ; fi done set pager=1 echo # after cryptomount, lvm volumes might be available for vol in ${lvmvol}; do try_user_config "${vol}" done ``` also: ``` leah@unimatrix0:~/Project/lbdev/lbmk/grub/grub-core/disk$ ls -1 *mdraid* mdraid1x_linux.c mdraid_linux_be.c mdraid_linux.c ``` GRUB has pretty decent support for RAID aswell. For example, I see in `mdraid_linux.c` the following: ``` if (level != 0 && level != 1 && level != 4 && level != 5 && level != 6 && level != 10) { grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET, "unsupported RAID level: %d", level); goto fail; } ``` How to interpret the above: if the RAID level isn't one of the levels in the `if` brackets, it goes to fail, meaning, it exits. Looking in the grub config for Libreboot, I don't see anything out of the ordinary. In fact, it's searching for user configs in non-RAID first. I'm leaving this open, but I don't yet know the answer to your problem. Sorry. Feel free to tweak the grub.cfg yourself, and see if you can get it working. See: <https://libreboot.org/docs/gnulinux/grub_cbfs.html>
Sign in to join this conversation.
No Label
No Milestone
No assignee
2 Participants
Loading...
Cancel
Save
There is no content yet.