zfsonlinux / grub

GRUB enhancements for ZFS on Linux
16 stars 18 forks source link

Ubuntu 14 on ZFS root : "couldn't find a valid label" #13

Open RJVB opened 10 years ago

RJVB commented 10 years ago

Transferred from https://github.com/zfsonlinux/zfs/issues/2348 at Turbo F's request:

As mentioned elsewhere, I'm trying to migrate a Kubuntu 14.04 LTS install to a ZFS root and I'm not having a lot of luck getting it to be bootable. The current mainstream grub2 package is not capable of generating a correct grub.cfg and bootloader (bug reported). There is no zfs-grub package in the "trusty" ppa, so I ended up installing the relevant packages I also use on my Debian rig (grub-pc, grub-pc-bin, grub-common and grub2-common) and those give a grub.cfg that appears to be correct:

if [ x$feature_default_font_path = xy ] ; then
   font=unicode
else
insmod part_msdos
insmod zfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  b927688a3f8a6e13
else
  search --no-floppy --fs-uuid --set=root b927688a3f8a6e13
fi
    font="/@/usr/share/grub/unicode.pf2"
fi

if loadfont $font ; then
  set gfxmode=1024x768
  load_video
  insmod gfxterm
  set locale_dir=$prefix/locale
  set lang=
  insmod gettext
fi
terminal_output gfxterm
if [ "${recordfail}" = 1 ] ; then
  set timeout=-1
else
  set timeout=5
fi

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
#set_background_image "images/tile.png";

set menu_color_normal=white/black
set menu_color_highlight=black/light-gray
if background_color 0,0,0; then
  clear
fi

function gfxmode {
    set gfxpayload="${1}"
}
set linux_gfx_mode=keep
export linux_gfx_mode
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-b927688a3f8a6e13' {
    load_video
    gfxmode $linux_gfx_mode
    insmod gzio
    insmod zfsinfo
    zfs-bootfs ($root) bootfs
    set rootdev=$root
    insmod part_msdos
    insmod ext2
    set root='hd1,msdos1'
    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  d276f9fc-c3bd-425e-9e4b-3d318546a1af
    else
      search --no-floppy --fs-uuid --set=root d276f9fc-c3bd-425e-9e4b-3d318546a1af
    fi
    set bootdev=$root
    echo 'Loading kernel 3.13.9 from '$bootdev' using '$bootfs' on '$rootdev'...'
    linux   /vmlinuz-3.13.9-ck1-kubuntu-ck-amdf10-rjvb root=ZFS=zPatux/ ro boot=zfs $bootfs   
    initrd  /initrd.img-3.13.9-ck1-kubuntu-ck-amdf10-rjvb
}

Disk UUIDs and the like (as well as the echo statement) aside, this is identical to what's in my Debian rig's grub.cfg, which uses the exact same kernel binaries.

However, the boot procedure requires manual import of the correct pool. The "Loading" echo statement in the snippet above suggests that the zfs-bootfs simply doesn't return a label at all:

screen shot 2014-05-25 at 19 42 16

That's a snapshot of a VirtualBox session, accessing the pool via "raw access" over FireWire 800, but I get the same result on real silicon. This same disk and pool held a clone of my Debian rig until recently, and that booted perfectly fine. NB: b927688a3f8a6e13 is the hex representation of the pool's ID, which I suppose is how it should be.