Comment 90 for bug 1274320

Revision history for this message
Niels Böhm (blubberdiblub) wrote :

I think there is a better "solution" (involving disabling recordfail in the affected cases, which is LVM for me).

I believe that the correct thing to use to check for LVM or RAID is grub-probe's "abstraction" target. This returns a list of possible abstractions below the filesystem level (or an empty string if there are none). For instance, on a system with just LVM here (hardware RAID is transparent to the system), it returns that:

    # grub-probe --target=abstraction /boot/
    lvm

On an older system with mdadm RAID1 and boot outside of LVM, it returns this:

    # grub-probe --target=abstraction /boot
    raid mdraid1x

    grub-probe --target=abstraction /
    raid mdraid1x lvm

Also note that older versions of grub-probe output an additional space at the end of the list if the list is non-empty, so mind that when parsing the output. There's no such superfluous space on trusty, tho.

So what I do is check the list for possible candidates that would fail with "recordfail". In my case, this is just "lvm" and I don't have a system here to test it with md RAID in practice, but I guess you would just need to extend the "for i in x y z" list with "raid".

The reason while the case statement inside the for loop looks as bit convoluted is that you could find the culprit at 4 possible places: making up the whole list, just at the beginning of the list, just at the end of the list or somewhere in the middle of the list.