Comment 3 for bug 1354730

Revision history for this message
TJ (tj) wrote : Re: 14.04 grub-install failed: Wrong number of args: mapdevfs <path>

The failure is due to grub_probe() returning more than one line when using btrfs. In the case of a 4-device raid1 created with:

make.btrfs -m raid1 -d raid1 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sds1

grub_probe() returns and assigns to $rootfs:

/dev/sda1
/dev/sdb1
/dev/sdc1
/dev/sdd1

which causes calls to mapdevfs to fail since it receives 4 arguments with error code 1 and message "Wrong number of args: mapdevfs <path>".

The fix is to amend the grub-installer script's grub_probe() function:

 diff -u grub-installer.orig grub-installer
--- grub-installer.orig 2014-08-10 04:22:23.009006148 +0100
+++ grub-installer 2014-08-10 04:22:38.249815612 +0100
@@ -113,7 +113,7 @@
                apt-install grub-common
                is_grub_common_installed=true
        fi
- $chroot $ROOT grub-probe $@
+ $chroot $ROOT grub-probe $@ | head -1
 }