[zfs-discuss] /dev/sdaN hardcodes in grub kernel parameters

Darik Horn dajhorn at vanadac.com
Thu May 24 11:29:12 EDT 2012

On Thu, May 17, 2012 at 10:09 PM, Derek Day <dayenterprises at gmail.com> wrote:
> So it looks as though my (and everyone else's) linux kernel lines are
> still being generated as linux /ROOT/Ubuntu/12.04/@/boot/
> vmlinuz-3.2.0-24-generic root=/dev/sdb3 ro boot=zfs $bootfs
> After all the care to avoid the AdaN style device names, this one
> breaks my boots unless I manually fixup my grub.cfg.
> I use the following manual fix:
> 1. use a label (in my case zroot) to find (one of ) the devices in my
> root pool.
> search --no-floppy --label --set=rootdev zroot
> insmod zfsinfo
> zfs-bootfs ($rootdev) bootfs
> set root=$rootdev
> linux /ROOT/Ubuntu/12.04/@/boot/vmlinuz-3.2.0-24-generic
> root=($rootdev) ro boot-zfs $bootfs
> I believe that I can only set root=$rootdev after invoking zfs-bootfs.
> 2. I also remove the line set root='(/dev/sdb,gpt3)'
> that precedes
> search --no-floppy --fs-uuid --set=root cd5ee85a5f1028c2
> since it does not make sense to me to set a variable to a likely bad
> value before setting it correctly. If the second command fails I don't
> want the default behavior to be indeterminate.

This is a correct solution, but three practical problems are:

1. GPT booting can be flakey, especially on UEFI.
2. GRUB has problems recognizing vdev replacements.
3. It is unreliable and/or incompatible with older Ubuntu releases.

Such corner cases are why the tutorial still recommends MBR
partitioning and a separate /boot area.

Note that resilvering or scrubbing the boot pool does not restore or
repair the system loader.  Run `grub-install` on each new member.
This bug also happens if the the new member is not formatted according
to the howto instructions before replacement.

> And really, I'd rather the generated grub config let me choose from a
> list of snapshots rather than kernel versions, then I could have a
> 'last known good' boot snapshot, etc. So, is there any possibility of
> inserting a submenu that would allow choosing a snapshot to use (e.g.
> where the @ is in my hardcode path above?)

Early releases did this, but it can overflow the grub menu and confuse
the operator.  Way-back, booting into a non-leaf filesystem node also
caused random kernel panics.

Porting `beadm` to Linux is likely the best solution.

> I don't see why I should need to specify a root device at all. I tell
> zfs what filesystem(s) I want to make bootable. Is there a grub
> command that would query zfs for filesystems(regular and snapshots) to
> use. Something like a search --no-floppy --zfs --set rootdev rpoolname
> or event zfs-bootfs bootfs (without specifying a device?).

The root parameter is still there because it:

* Minimized patch size in the overlay.
* Demonstrates a bug where GRUB inconsistently enumerates devices.
* Causes a better error message for bug reports. (eg: "/dev/sdb,gpt3"
above indicates an unsupported configuration.)

I will revisit the ZoL implementation when grub-2.00 is released and
packaged for Debian, maybe in time for Ubuntu 12.10, but more likely
for the 13.04 release.

However, I'm also thinking that the Illumos or FreeBSD solutions could
be a better alternative for ZoL systems, like grub-legacy or

Darik Horn <dajhorn at vanadac.com>

More information about the zfs-discuss mailing list