Created attachment 670777 [details] error message issued by grub2-probe Description of problem: Although a usable grub.cfg is produced by grub2-mkconfig, two error messages are issued from 10_linux and 20_linux_xen. The error message is issued by grub2-probe and complains about the GRUB DEVICE. The "problem" is that the root for that system is installed on a btrfs filesystem subvolume and the filesystem is on two partitions Version-Release number of selected component (if applicable): F18, grub2/grub2-tools 2.00-15 How reproducible: yes Steps to Reproduce: Best/easily done virtually. Install F18 into a btrfs root. After bootup, run grub2-mkconfig. Then format another partition as btrfs and add it to the existing btrfs filesystem. Run grub2-mkconfig again. Attached is the output error message. You will notice that the device is actually a two line list.
With the patches associated with the following applied: https://bugzilla.redhat.com/show_bug.cgi?id=888341 https://bugzilla.redhat.com/show_bug.cgi?id=890987 30_os-prober handles the multi-device btrfs volume (storage pool) by using the UUID. However, 10_linux has the problem because it is used the device names which result in three devices listed for a three-device btrfs volume.
Created attachment 676998 [details] support for multi-device btrfs volume Simply fixes the problem.
FWIW, it is not very obvious why this patch fixes the problem. A short description of the problem and the solution would be helpful. But it would probably be better to file and fix it upstream and then request a backport here.
I am not knowledgeable enough about bash scripting to understand why it did not work with the double quotes and did work without them. I added an -x to 10_linux and then watched what was executed in grub-mkconfig_lib The system has a three-device btrfs volume defined and the bash variable has all three listed. I tried duplicating what I saw happen in the script at the command line. With the double quotes, grub2-probe complains. Without them, it is OK. I just did a little more testing. The extra double quotes make each device on a separate line whereas without the double quotes they are all on one line separated by spaces.
As far as a "backport" for Fedora ... give me a break! grub2 for F18 already has a whole bunch of patches. And, as far as reporting this upstream, yes, that is a good idea except that grub2 has yet another bug reporting scheme and I have no interest in getting involved with any more than I have to.
Try: f() { while [ "$1" ]; do echo "[$1]"; shift; done; } c="c c" d="d d" x="`f a "b b" $c "$d"`" echo "$x" [a] [b b] [c] [c] [d d] Removing the quotes when device="/dev/vdb3 /dev/vdd1" will thus run grub2-probe --device /dev/vdb3 /dev/vdd1 ... That patch is thus not the right solution.
The f18 patches are all upstreamed ... perhaps except for the secure boot stuff.
Actually, I believe that the right solution is that this test should not be run at all. This is a multi-device btrfs volume and the test is for lvm. It should be tested for being btrfs and, if it is, then skip the lvm test. The real problem is that grub2 is not aware enough of btrfs and the only other filesystem I can think of that could have a similar problem is zfs. The think is that the grub2-probe error has no effect on the outcome and a good grub.cfg is created. Now, as to your suggest above ... I do not understand your point. My simple solution works because the additional devices are ignored. What I did work because the second and third devices are ignored and as far as I know, only btrfs and zfs are multi-device volumes. Yes, LVM Volume Groups can be multi-device but grub2 does not look at them. But, you do have a point that my solution is a "hack" and it should really be handled better ... that is, if we are looking at a btrfs multi-device volume, do not run this test.
I think bug 868473 is a duplicate of this, if so feel free to mark it as such.
*** Bug 868473 has been marked as a duplicate of this bug. ***
After further consideration, I am sticking with my patch as is. The removal of the extra double quotes is exactly the same thing done in line 133 of grub2-mkconfig. If it is wrong here, a lot more things need to be fixed.
You probably need to file an upstream bug report and file the patch there, or post to grub-devel@. Once you've done that I think you can insert the upstream bug URL into "See Also" or "URL fields in the redhat bz.
This problem and patch as well as the os-prober releated patch have both been reported upstream to bug-grub and the os-prober patches were sent to bugs.debian.org
Ok, I agree that it is the right solution. Because: the devices are not given to grub2-probe as the value for --device. --device is flag and the devices are positional parameters that should appear individually. (Putting positional parameters between options is IMO not so elegant ... and apparently confusing.)
(In reply to comment #13) > This problem and patch as well as the os-prober releated patch have both > been reported upstream to bug-grub and the os-prober patches were > sent to bugs.debian.org Generating grub.cfg ... Found theme: /boot/grub2/themes/system/theme.txt /usr/sbin/grub2-probe: error: cannot find a GRUB drive for /dev/sda3 /dev/sdb3. Check your device.map. Found linux image: /boot/vmlinuz-3.9.0-0.rc6.git1.1.fc20.i686.PAE Found initrd image: /boot/initramfs-3.9.0-0.rc6.git1.1.fc20.i686.PAE.img Found linux image: /boot/vmlinuz-3.9.0-0.rc6.git0.1.fc20.i686.PAE Found initrd image: /boot/initramfs-3.9.0-0.rc6.git0.1.fc20.i686.PAE.img Found linux image: /boot/vmlinuz-3.9.0-0.rc5.git3.1.fc20.i686.PAE Found initrd image: /boot/initramfs-3.9.0-0.rc5.git3.1.fc20.i686.PAE.img Found linux image: /boot/vmlinuz-0-rescue-e567d261136e65c44daec4be883d00f5 Found initrd image: /boot/initramfs-0-rescue-e567d261136e65c44daec4be883d00f5.img /usr/sbin/grub2-probe: error: cannot find a GRUB drive for /dev/sda3 /dev/sdb3. Check your device.map. done Patched(676998): Generating grub.cfg ... Found theme: /boot/grub2/themes/system/theme.txt Found linux image: /boot/vmlinuz-3.9.0-0.rc6.git1.1.fc20.i686.PAE Found initrd image: /boot/initramfs-3.9.0-0.rc6.git1.1.fc20.i686.PAE.img Found linux image: /boot/vmlinuz-3.9.0-0.rc6.git0.1.fc20.i686.PAE Found initrd image: /boot/initramfs-3.9.0-0.rc6.git0.1.fc20.i686.PAE.img Found linux image: /boot/vmlinuz-3.9.0-0.rc5.git3.1.fc20.i686.PAE Found initrd image: /boot/initramfs-3.9.0-0.rc5.git3.1.fc20.i686.PAE.img Found linux image: /boot/vmlinuz-0-rescue-e567d261136e65c44daec4be883d00f5 Found initrd image: /boot/initramfs-0-rescue-e567d261136e65c44daec4be883d00f5.img done What's the point of probe's error!? Outputs are equal. Except in the case where the boot is Btrfs subvolume(not this one), when *both* mkconfig and grubby are troubled(rhbz#864198). mkconfig & grubby - two tools for the same thing!? Do we wait for a patch or Godot? ;)
Comment on attachment 670777 [details] error message issued by grub2-probe I was just going to open a bug on this, with a patch: basically uses_abstraction () in grub-mkconfig_lib receives a list of devices separated by blanks (the value of GRUB_DEVICE) as $1. It copies the whole argument including the blanks into shell variable device. But grub2-probe requires each device to be a separate argument. This is accomplished by omitting the double quotes: grub2-probe --device ${device} --target=abstraction rather than grub2-probe --device "${device}" --target=abstraction
... obviously I hadn't read all the comments. ... I did look at grub2-probe and saw that multiple arguments are allowed after --device. It would have been nice for this to be fixed already, but I guess that's what I get for using btrfs. The misleading error message cost some time because I thought that was the reason grub.cfg had no entries. (Actually the reason was I had created a new boot partition and run grub2-install but not copied any kernels in.) To actually fix it properly, so that device names containing blanks would work, you need to make GRUB_DEVICE an array and explicitly separate the arguments using the quoted @ syntax. The patch ought to add a comment explaining what is going on: +# $1 may be a list of devices separated by blanks. grub_probe accepts +# multiple arguments after --device but each device must be in a separate +# argument. Hence ${device} rather than "${device}".
Created attachment 786358 [details] This version makes the code more maintainable as well as fixing the problem.
This STILL HAS NOT BEEN FIXED!!! I checked the code in the grub2 src.rpm which includes a huge number of patches but NOT this one. I suppose this is another one of those ... it is BTRFS so we can just ignore it problems.
Created attachment 812228 [details] patch against grub2-2.00-25.fc20 Updated for the version in Fedora 20 and merged in the changed made by Edward J. Huff to make the change clearer.
I suggest direction submission of the patch to <grub-devel>.
It is not clear to me that submitting anything to grub-devel would be worth the effort. If you look into the grub2 src.rpm you will see a tarball dated mid 2012 and 484 (!) patch files. Believe it or not, git is used within the rpm to apply the patches and, from looking at some of the patches, there is a git repository somewhere that is used to maintain what is being used on Fedora and Red Hat systems. But, as a matter of fact, I did submit the fix for this problem to bug-grub on 12 January 2013 ... response ... it went into a black hole! Best bet is to get the Fedora/Red Hat maintainers to add this to the local set of patches. The big part of that problem is that this is one more example of "oh, yes, this is btrfs related so we can ignore it." After all, how many folks might be running a multi-volume system disk ... well, me for one (actually I currently have two such systems and am about to add a third).
This problem is fixed by upstream: commit 588744d0dc655177d5883bdcb8f72ff5160109ed It would be nice if this was fixed sooner rather than later.
Please see https://bugzilla.redhat.com/show_bug.cgi?id=1023161
problem addressed in latest grub2 in rawhide