14.04 grub-install failed: Wrong number of args: mapdevfs <path>

Bug #1354730 reported by Willem Ligtenberg on 2014-08-09
132
This bug affects 18 people
Affects Status Importance Assigned to Milestone
grub-installer (Ubuntu)
Critical
Unassigned
Trusty
Medium
Unassigned

Bug Description

I was previously able to install ubuntu on a root btrfs filesystem in raid1 mode as I described here:
http://askubuntu.com/questions/87241/how-to-install-using-btrfs-in-raid10-mode

So I used gparted to create btrfs partitions on all the disksand left 1 MB at the beginning of the disks for GRUB. (I also tried 2, and 5)

Then later I made the btrfs filesystem as follows:
mkfs.btrfs -m raid1 -d raid1 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
And performed:
btrfs dev scan

Then I went back through normal installation.

I am now trying to do this again, using Ubuntu 14.04.
Everything goes fine up to the point that it wants to install grub.
It mentions the error in the title and fails.

Apparently, somebody else also reported an error like this with 14.04.
https://bugs.launchpad.net/ubuntu/+source/grub-installer/+bug/912431 (at the bottom a person mentions that it occurs in 14.04)

I will attach some files later.

Willem Ligtenberg (wligtenberg) wrote :

syslog of the installer

Willem Ligtenberg (wligtenberg) wrote :

preseed file

description: updated
TJ (tj) on 2014-08-10
Changed in grub-installer (Ubuntu):
status: New → In Progress
importance: Undecided → High
assignee: nobody → TJ (tj)
TJ (tj) wrote :

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
 }

Changed in grub-installer (Ubuntu):
status: In Progress → Triaged
TJ (tj) wrote :

Bug-fix branch linked

Changed in grub-installer (Ubuntu):
assignee: TJ (tj) → nobody
Willem Ligtenberg (wligtenberg) wrote :

Is there a way I can test this patch?
Because I assume that it is more complicated since it has to be on the install media.

On 10/08/14 08:02, Willem Ligtenberg wrote:
> Is there a way I can test this patch?

1. Start the installer and pause it at some user prompt
2. Start a terminal shell (switch to an alternative VT or start an xterm or if using -server install use the "Execute a Shell" main-menu option)
3. Execute "sed -i 's/\($chroot $ROOT grub-probe $@\)/\1 | head -1/' /usr/bin/grub-installer
4. Return to the installer and continue

TJ (tj) on 2014-08-11
Changed in grub-installer (Ubuntu):
assignee: nobody → TJ (tj)
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub-installer - 1.78ubuntu25

---------------
grub-installer (1.78ubuntu25) vivid; urgency=medium

  * grub_probe(): return a single line in BTRFS multi-disk RAID configurations
    (LP: #1354730).
 -- TJ <email address hidden> Thu, 19 Feb 2015 11:44:43 -0500

Changed in grub-installer (Ubuntu):
status: Triaged → Fix Released

As I recall there is also a branch to bring this to Trusty, but it's not closing the bug.

(fwiw, that's https://code.launchpad.net/~tj/ubuntu/trusty/grub-installer/lp1354730/+merge/230222)

I'm nominating this for Trusty, so as soon as you have time to update the branch (following the same changes as done in vivid), TJ, we can SRU this... but this bug report will also need an update of it's description for the SRU process (http://wiki.ubuntu.com/StableReleaseUpdates#Procedure).

Thanks!

Changed in grub-installer (Ubuntu Trusty):
importance: Undecided → Medium
status: New → Triaged

I'm reverting this, as it's been found that it misbehaves when trying to install the bootloader using Guided - use entire disk with LVM, on recent server images.

Reopening...

Changed in grub-installer (Ubuntu):
status: Fix Released → Triaged
assignee: TJ (tj) → nobody
Nick Fish (nichfish) wrote :

FYI, for anyone that wants to use the original fix as a workaround until an official fix is released, the grub-installer script can be found at /usr/share/grub-installer/grub-installer on more recent versions of Ubuntu. So, step #3 given by TJ above becomes:

sed -i 's/\($chroot $ROOT grub-probe $@\)/\1 | head -1/' /usr/share/grub-installer/grub-installer

Changing this (I used nano to edit the file instead of sed) enabled me to install Ubuntu 14.04 LTS Desktop on a BTRFS raid setup without issue.

Phillip Susi (psusi) on 2016-07-11
Changed in grub-installer (Ubuntu):
importance: High → Critical
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers