Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#36176 - [grub] grub-mkconfig_lib creates "search" lines incorrectly for multi-device volumes

Attached to Project: Arch Linux
Opened by Evan Callicoat (Apsu) - Tuesday, 16 July 2013, 20:43 GMT
Last edited by Tobias Powalowski (tpowa) - Thursday, 24 October 2013, 12:13 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Ronald van Haren (pressh)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

When grub-mkconfig is called for a grub installation on a multi-device btrfs volume, the function prepare_grub_to_access_device() is called from the /usr/share/grub/grub-mkconfig_lib bash library, which has this block of code in it:

if fs_uuid="`"${grub_probe}" --device "$@" --target=fs_uuid 2> /dev/null`" ; then
hints="`"${grub_probe}" --device "$@" --target=hints_string 2> /dev/null`" || hints=
echo "if [ x\$feature_platform_search_hint = xy ]; then"
echo " search --no-floppy --fs-uuid --set=root ${hints} ${fs_uuid}"
echo "else"
echo " search --no-floppy --fs-uuid --set=root ${fs_uuid}"
echo "fi"
fi

The ${grub_probe} call with --target=hints_string will return multiple lines of output when --device refers to more than one device, which is the case for multi-device btrfs volumes (and probably others). Normally, the newlines would be converted to space-separated fields via the default IFS, but because the echo lines put double-quotes around ${hints}, the newline separators are preserved, resulting in a completely broken "search" line output in grub.cfg.

It seems that the search and its hints isn't strictly necessary as I haven't seen any configuration fail to boot without it, but this is a fairly simple bug to fix so I figured I should follow up on it.

This is not an Arch-specific bug, as the exact same code is present in the current trunk repo on savannah.gnu.org for grub. I plan on making the same bug-report there, but my experience with savannah (and looking at the bugs in the grub tracker in particular) is that it's unlikely to get fixed soon, if ever, so it might be worth Arch carrying a simple patch.
This task depends upon

Closed by  Tobias Powalowski (tpowa)
Thursday, 24 October 2013, 12:13 GMT
Reason for closing:  Fixed
Comment by Evan Callicoat (Apsu) - Tuesday, 16 July 2013, 20:51 GMT Comment by Keshav Amburay (the.ridikulus.rat) - Saturday, 27 July 2013, 22:17 GMT
I suggest taking this up in grub-devel or bug-grub mailing lists. The upstream is more responsive in ML than savannah bug tracker based on my experience. You can also try #grub irc.
Comment by Keshav Amburay (the.ridikulus.rat) - Saturday, 27 July 2013, 22:18 GMT
Is this bug in any way related to https://bugs.archlinux.org/task/31156 ?
Comment by Evan Callicoat (Apsu) - Monday, 29 July 2013, 15:55 GMT
@Keshav yes, I would say this is the same kind of bug, just seen in a different section of the config-generating code. grub-probe probably spat out two lines and the generator code probably uses echo "...", which retains the newline.
Comment by Keshav Amburay (the.ridikulus.rat) - Monday, 14 October 2013, 17:04 GMT

Loading...