grub-pc, grub2 doesn't check /dev/disk/by-id or "by-path" for zfs zpool

Bug #1590740 reported by brian mullan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grub2 (Ubuntu)
New
Wishlist
Unassigned

Bug Description

When creating an Ubuntu 16.04 root install on a zfs using disks & zfs pool created using "/dev/disk/by-id" and I get to the point of running:

          apt install grub-pc

I select the 4 disks I am putting into the ZFS pool to have grub installed into but grub-pc fails (see attached screen shot):

Note: first problem is that "menu" presented by grub-pc lists them as

/dev/sda
/dev/sdb
/dev/sdc
/dev/sdd

I think they should be listed as their "by-id" or "by-path" ... if you created the zfs disks and pool with that!

In my case the disks were created/partitioned using:

sgdisk -Z -n9:-8M:0 -t9:bf07 -c9:Reserved -n2:-8M:0 -t2:ef02 -c2:GRUB -n1:0:0 -t1:bf01 -c1:ZFS \
        /dev/disk/by-id/ata-ST2000DM001-1CH164_W1E8JLV9

sgdisk -Z -n9:-8M:0 -t9:bf07 -c9:Reserved -n2:-8M:0 -t2:ef02 -c2:GRUB -n1:0:0 -t1:bf01 -c1:ZFS \
        /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E0713E

sgdisk -Z -n9:-8M:0 -t9:bf07 -c9:Reserved -n2:-8M:0 -t2:ef02 -c2:GRUB -n1:0:0 -t1:bf01 -c1:ZFS \
        /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E084AP

sgdisk -Z -n9:-8M:0 -t9:bf07 -c9:Reserved -n2:-8M:0 -t2:ef02 -c2:GRUB -n1:0:0 -t1:bf01 -c1:ZFS \
        /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E06YPY

later I use this command to created the ZFS Pool of 2 mirrors each with 2 HDs using "by-id".

zpool create -o ashift=12 -O atime=off -O canmount=off -O compression=lz4 \
     -O normalization=formD -O mountpoint=/ -R /mnt rpool mirror \
     /dev/disk/by-id/ata-ST2000DM001-1CH164_W1E8JLV9-part1 \
     /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E0713E-part1 \
     mirror /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E084AP-part1 \
     /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E06YPY-part1 -f

And confirm the ZFS pool is created correctly by:

      zpool status

which DOES and the above shows the disks "by-id" and NOT as sda, sdb, sdc, sdd

But later in the process when running "apt install grub-pc" the disks are listed as /dev/sda, /dev/sdb etc.

The grub-pc "form" where you select where to install should probably look something like if the disks were created "by-id":

     [ ] /dev/disk/by-id/ata-ST2000DM001-1CH164_W1E8JLV9
     [ ] /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E0713E
     [ ] /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E084AP
     [ ] /dev/disk/by-id/ata-ST2000DM001-9YN164_Z1E06YPY

I did find a thread online where there is/was alot of discussion about this problem!

     https://github.com/zfsonlinux/grub/issues/5

Some work-arounds were suggested but also some where discussing the root cause.

I think in 16.04 this Grub problem still exists.

My reasoning is that despite how I created the disks & the pool when I ran "apt install grub-pc" it lists the choices as /dev/sda, /dev/sdb etc.

And if I just go ahead and select those disks (I figured why not try and see what happens right?) then I get the errors shown in the attached screen shot.

This "may" be a zfsonlinux BUG but since Ubuntu is now supporting ZFS I figured I'd report it here so others encountering it know what is going on.

Lastly...

I would suggest that the current Ubuntu Documentation on this is incorrect:

https://wiki.ubuntu.com/Kernel/Reference/ZFS

The Ubuntu ZFS documentation says:

ZFS Pools

A zpool is a pool of storage made from a collection of VDEVS. One or more ZFS file systems can be created from a ZFS pool.

In the following example, a pool named "pool-test" is created from 3 physical drives:

$ sudo zpool create pool-test /dev/sdb /dev/sdc /dev/sdd

Striping is performed dynamically, so this creates a zero redundancy RAID-0 pool.

Notice: If you are managing many devices, it can be easy to confuse them, so you should probably prefer /dev/disk/by-id/ names, which often use serial numbers of drives. The examples here should not suggest that 'sd_' names are preferred. They merely make examples herein easier to read.

THE ABOVE Notice I think is inaccurate in suggesting "you should probably prefer"... from all the documentation and examples I have found including the official example for installing

Ubuntu 16.04 Root on ZFS:
https://github.com/zfsonlinux/zfs/wiki/Ubuntu%2016.04%20Root%20on%20ZFS

Where in "2.2 Partition your disk" it says:

"Always use the long /dev/disk/by-id/* aliases with ZFS. Using the /dev/sd* device nodes
directly can cause sporadic import failures, especially on systems that have more than one storage pool."

Tags: zfs
Revision history for this message
brian mullan (bmullan) wrote :
Revision history for this message
brian mullan (bmullan) wrote :

added some updated info.

Revision history for this message
Steve Langasek (vorlon) wrote :

Ubuntu 16.04 does not support root on zfs. Marking as wishlist.

affects: grub (Ubuntu) → grub2 (Ubuntu)
Changed in grub2 (Ubuntu):
importance: Undecided → Wishlist
Revision history for this message
brian mullan (bmullan) wrote :

Steve
Thx but so far I and others are installing Ubuntu 16.04 root on zfs and it runs ok.

I think I even included the zfsonlinux guide in the orig report.

I think the only real problem I've had is this issue with grub-pc not parsing ZFS disks "by-id".

Revision history for this message
brian mullan (bmullan) wrote :

Just heard from a Reddit zfs thread inquery I made that the fix for grub & zfs is aleady in 16.10 & will make it into 16.04 in perhaps a month..

The fix is being tracked with this bug:

https://bugs.launchpad.net/ubuntu/xenial/+source/grub2/+bug/1527727

So my bug report can be closed.

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.