grub-installer might not install to the PReP partition of NVMe disks

Bug #1656048 reported by bugproxy
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub-installer (Ubuntu)
Fix Released
High
Mathieu Trudel-Lapierre
Xenial
Fix Released
High
Mathieu Trudel-Lapierre

Bug Description

[Impact]
NVMe installs on ppc64el for PReP.

[Test case]
Attempt to install Ubuntu on a ppc64el where a PReP partition is required; make sure to put the new PReP partition on the NVMe disk. See Problem Description below.

[Regression Potential]
Any failure to install PReP on ppc64el on a system with NVMe should be considered a regression of this bug.

----

== Comment: #0 - Mauricio Faria De Oliveira - 2017-01-12 05:22:08 ==
---Problem Description---
On ppc64el, the grub-installer script attempts to detect which PReP partition is in the same disk as of the installed system, in order to install grub into it.

This check is not working properly for NVMe devices, and needs an update.
It might result in overwriting the PReP partition of another disk, possibly another Linux distro/version, which is unrelated to the current installation.

Patches for Xenial and Zesty are attached.

Problem example:
---

- PReP partition actually is '/dev/nvme1n1p1'
- PReP partition detected is '/dev/sda1'

    ~ # /usr/lib/grub-installer/prep-bootdev -l
    /dev/sda1
    /dev/nvme1n1p1
    /dev/nvme0n1p1

    ~ # grep grub-install /var/log/syslog
    ...
    Jan 11 22:17:25 main-menu[518]: INFO: Menu item 'grub-installer' selected
    Jan 11 22:17:25 grub-installer: info: architecture: ppc64el/chrp_ibm
    Jan 11 22:17:29 grub-installer: info: Identified partition label for /dev/nvme1n1p2: gpt
    Jan 11 22:17:29 grub-installer: info: Wiping PReP partition /dev/sda1
    ...
    Jan 11 22:17:33 grub-installer: info: Running chroot /target grub-install --force "/dev/sda1"
    ...
    Jan 11 22:17:33 grub-installer: info: grub-install ran successfully

    ~ # in-target ofpathname /dev/sda1
    ~ # in-target nvram --print-config=boot-device

    ~ # tail -n2 /var/log/syslog
    ... in-target: /pci@800000020000015/pci1014,034A@0/sas/disk@5000c50067b1166b
    ... in-target: /pci@800000020000015/pci1014,034A@0/sas/disk@5000c50067b1166b

Patch applied:
---

~ # grep grub-installer /var/log/syslog
...
Jan 11 23:59:25 main-menu[518]: INFO: Menu item 'grub-installer' selected
Jan 11 23:59:25 grub-installer: info: architecture: ppc64el/chrp_ibm
Jan 11 23:59:27 grub-installer: info: Identified partition label for /dev/nvme1n1p2: gpt
Jan 11 23:59:27 grub-installer: info: Wiping PReP partition /dev/nvme1n1p1
...
Jan 11 23:59:30 grub-installer: info: Running chroot /target grub-install --force "/dev/nvme1n1p1"
...
Jan 11 23:59:31 grub-installer: info: grub-install ran successfully

    ~ # in-target nvram --print-config=boot-device
    ~ # tail -n1 /var/log/syslog
    ... in-target: /pci@800000020000028/pci1bb1,121@0/namespace@1

After reboot of installation done:

    0 > printenv boot-device
    -------------- Partition: common -------- Signature: 0x70 ---------------
    boot-device /pci@800000020000028/pci1bb1,121@0/namespace@1

== Comment: #1 - Mauricio Faria De Oliveira <email address hidden> - 2017-01-12 05:24:08 ==
Patch for Xenial

== Comment: #2 - Mauricio Faria De Oliveira <email address hidden> - 2017-01-12 05:24:26 ==
Patch for Zesty.

Revision history for this message
bugproxy (bugproxy) wrote : grub-installer_prep-nvme-disk_xenial.debdiff

Default Comment by Bridge

tags: added: architecture-ppc64le bugnameltc-150508 severity-high targetmilestone-inin16042
Revision history for this message
bugproxy (bugproxy) wrote : grub-installer_prep-nvme-disk_zesty.debdiff

Default Comment by Bridge

Changed in ubuntu:
assignee: nobody → Taco Screen team (taco-screen-team)
affects: ubuntu → debian-installer (Ubuntu)
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-01-12 13:48 EDT-------
Hi @taco-screen-team,

May you please assign/check with @cyphermox for this one?
He's handled this script/area before for ppc64el.

Thank you,
Mauricio

Revision history for this message
Mathieu Trudel-Lapierre (cyphermox) wrote :

This needs a fix in grub-installer.

Changed in debian-installer (Ubuntu):
assignee: Taco Screen team (taco-screen-team) → Mathieu Trudel-Lapierre (cyphermox)
status: New → In Progress
importance: Undecided → High
affects: debian-installer (Ubuntu) → grub-installer (Ubuntu)
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2017-01-13 11:09 EDT-------
@cyphermox wrote a different patch, and we coordinated testing of that via IRC.

That is [1], which is verified OK in the system used to debug this.

[1] https://launchpad.net/~cyphermox/+archive/ubuntu/installer-dev/+build/11854412

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub-installer - 1.128ubuntu7

---------------
grub-installer (1.128ubuntu7) zesty; urgency=medium

  * grub-installer: deal with NVMe devices (or other devices with a partition
    separator) being used to back the PReP partition on ppc64el. (LP: #1656048)

 -- Mathieu Trudel-Lapierre <email address hidden> Fri, 13 Jan 2017 16:19:30 -0500

Changed in grub-installer (Ubuntu):
status: In Progress → Fix Released
description: updated
Changed in grub-installer (Ubuntu Xenial):
importance: Undecided → High
status: New → In Progress
assignee: nobody → Mathieu Trudel-Lapierre (cyphermox)
Changed in grub-installer (Ubuntu):
milestone: none → ubuntu-17.01
Revision history for this message
Steve Langasek (vorlon) wrote : Please test proposed package

Hello bugproxy, or anyone else affected,

Accepted grub-installer into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/grub-installer/1.128ubuntu5.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in grub-installer (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2017-01-27 08:18 EDT-------
Verification done on Xenial. All good!

Used the netboot image in xenial-updates as of Jan 27, with kernel cmdline args 'apt-setup/proposed=true'.

Created a guest w/ a virtual SCSI drive and NVMe drive in PCI-passthrough mode.
In the partitioning dialog, created a PReP partition in the SCSI drive (sda1) so to make sure it's listed first in "prep_bootdev -l", which caused the problem previously.

After installation, gone back to shell and verified that grub-installer indeed used the nvme drive, even though the SCSI drive showed up first in "prep_bootdev -l".. and that the new script bits were downloaded (version 1.128ubuntu5.1) and in place.

~ # /usr/lib/grub-installer/prep-bootdev -l
/dev/sda1
/dev/nvme0n1p1

~ # grep grub-install /var/log/syslog
Jan 27 12:57:03 anna[1761]: DEBUG: retrieving grub-installer 1.128ubuntu5.1
Jan 27 12:57:04 anna[1761]: 2017-01-27 12:57:04 URL:http://us.ports.ubuntu.com/ubuntu-ports//pool/main/g/grub-installer/grub-installer_1.128ubuntu5.1_ppc64el.udeb [252334/252334] -> "/var/cache/anna/grub-installer_1.128ubuntu5.1_ppc64el.udeb" [1]
Jan 27 13:05:25 main-menu[518]: INFO: Menu item 'grub-installer' selected
Jan 27 13:05:25 grub-installer: info: architecture: ppc64el/chrp_ibm
Jan 27 13:05:29 grub-installer: info: Identified partition label for /dev/nvme0n1p2: gpt
Jan 27 13:05:29 grub-installer: info: Wiping PReP partition /dev/nvme0n1p1
Jan 27 13:05:31 in-target: grub-install: warning: unknown device type nvme0n1p2^M
Jan 27 13:05:31 grub-installer: info: Installing grub on '/dev/nvme0n1p1'
Jan 27 13:05:31 grub-installer: info: grub-install does not support --no-floppy
Jan 27 13:05:31 grub-installer: info: Running chroot /target grub-install --force "/dev/nvme0n1p1"
Jan 27 13:05:31 grub-installer: Installing for powerpc-ieee1275 platform.
Jan 27 13:05:32 grub-installer: Installation finished. No error reported.
Jan 27 13:05:32 grub-installer: info: grub-install ran successfully

~ # grep split_device /usr/bin/grub-installer
split_device () {
prep_dev=$(split_device $prep_p)
offered=$(split_device $disc_offered)
bootdev_split="$(split_device "$bootdev")"
bootfs_split="$(split_device "$bootfs")"

tags: added: verification-done
removed: verification-needed
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2017-01-27 08:21 EDT-------
For documentation purposes, here's the virt-install line used.

(In reply to comment #13)
> Used the netboot image in xenial-updates as of Jan 27, with kernel cmdline
> args 'apt-setup/proposed=true'.
>
> Created a guest w/ a virtual SCSI drive and NVMe drive in PCI-passthrough
> mode.

qemu-img create -f qcow2 /var/lib/libvirt/images/mauricfo-16041-pcipt.qcow2 128g

virsh nodedev-detach pci_0005_01_00_0

virt-install \
--name mauricfo-16041 \
--location http://ports.ubuntu.com/ubuntu-ports/dists/xenial-updates/main/installer-ppc64el/ \
--extra-args "apt-setup/proposed=true" \
--vcpus 8,sockets=1,cores=1,threads=8 \
--memory 8192 \
--controller type=scsi,model=virtio-scsi \
--disk format=qcow2,path=/var/lib/libvirt/images/mauricfo-16041-pcipt.qcow2 \
--network bridge=virbr0,model=virtio \
--hostdev pci_0005_01_00_0

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package grub-installer - 1.128ubuntu5.1

---------------
grub-installer (1.128ubuntu5.1) xenial; urgency=medium

  * grub-installer: deal with NVMe devices (or other devices with a partition
    separator) being used to back the PReP partition on ppc64el. (LP: #1656048)

 -- Mathieu Trudel-Lapierre <email address hidden> Fri, 13 Jan 2017 16:19:30 -0500

Changed in grub-installer (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Chris J Arges (arges) wrote : Update Released

The verification of the Stable Release Update for grub-installer has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.