Bug 890955 - error messages for BTRFS multi-partition root
Summary: error messages for BTRFS multi-partition root
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: grub2
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Peter Jones
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 868473 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-12-31 12:17 UTC by Gene Czarcinski
Modified: 2014-04-21 18:00 UTC (History)
8 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-04-21 18:00:41 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
error message issued by grub2-probe (104 bytes, text/plain)
2012-12-31 12:17 UTC, Gene Czarcinski
no flags Details
support for multi-device btrfs volume (1.06 KB, patch)
2013-01-11 17:02 UTC, Gene Czarcinski
gczarcinski: review+
Details | Diff
This version makes the code more maintainable as well as fixing the problem. (743 bytes, patch)
2013-08-14 01:33 UTC, Edward J. Huff
no flags Details | Diff
patch against grub2-2.00-25.fc20 (1.46 KB, patch)
2013-10-14 20:43 UTC, Gene Czarcinski
gczarcinski: review+
Details | Diff

Description Gene Czarcinski 2012-12-31 12:17:41 UTC
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.

Comment 1 Gene Czarcinski 2013-01-11 14:09:52 UTC
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.

Comment 2 Gene Czarcinski 2013-01-11 17:02:26 UTC
Created attachment 676998 [details]
support for multi-device btrfs volume

Simply fixes the problem.

Comment 3 Mads Kiilerich 2013-01-12 12:17:51 UTC
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.

Comment 4 Gene Czarcinski 2013-01-12 16:33:53 UTC
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.

Comment 5 Gene Czarcinski 2013-01-12 16:40:29 UTC
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.

Comment 6 Mads Kiilerich 2013-01-12 16:54:08 UTC
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.

Comment 7 Mads Kiilerich 2013-01-12 16:57:43 UTC
The f18 patches are all upstreamed ... perhaps except for the secure boot stuff.

Comment 8 Gene Czarcinski 2013-01-12 17:35:35 UTC
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.

Comment 9 Chris Murphy 2013-01-12 18:10:26 UTC
I think bug 868473 is a duplicate of this, if so feel free to mark it as such.

Comment 10 Gene Czarcinski 2013-01-12 19:35:08 UTC
*** Bug 868473 has been marked as a duplicate of this bug. ***

Comment 11 Gene Czarcinski 2013-01-12 19:39:39 UTC
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.

Comment 12 Chris Murphy 2013-01-12 20:05:47 UTC
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.

Comment 13 Gene Czarcinski 2013-01-13 15:35:17 UTC
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

Comment 14 Mads Kiilerich 2013-01-14 00:47:31 UTC
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.)

Comment 15 poma 2013-04-11 18:25:51 UTC
(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 16 Edward J. Huff 2013-08-14 01:09:37 UTC
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

Comment 17 Edward J. Huff 2013-08-14 01:27:23 UTC
... 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}".

Comment 18 Edward J. Huff 2013-08-14 01:33:56 UTC
Created attachment 786358 [details]
This version makes the code more maintainable as well as fixing the problem.

Comment 19 Gene Czarcinski 2013-10-14 18:50:41 UTC
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.

Comment 20 Gene Czarcinski 2013-10-14 20:43:01 UTC
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.

Comment 21 Chris Murphy 2013-10-14 20:49:32 UTC
I suggest direction submission of the patch to <grub-devel>.

Comment 22 Gene Czarcinski 2013-10-20 10:15:20 UTC
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).

Comment 23 Gene Czarcinski 2013-10-27 17:57:07 UTC
This problem is fixed by upstream:
      commit 588744d0dc655177d5883bdcb8f72ff5160109ed

It would be nice if this was fixed sooner rather than later.

Comment 24 Gene Czarcinski 2013-11-13 14:07:35 UTC
Please see https://bugzilla.redhat.com/show_bug.cgi?id=1023161

Comment 25 Gene Czarcinski 2014-04-21 18:00:41 UTC
problem addressed in latest grub2 in rawhide


Note You need to log in before you can comment on or make changes to this bug.