[Bug 1420584] Re: "error: invalid segment." (with btrfs on LVM on LUKS)

EmanueL Czirai emanueLczirai at cryptoLab.net
Sat Feb 14 00:39:21 UTC 2015


I've fixed my issue with lvmids mentioned above; it's specific only to
me because I was using a non-standard /boot directory (called /but )
which needed a change in grub2-mkconfig script.

Otherwise, grub is working ok with the above 2 patches. I've also sent
an email to one of the devs(from a git blame commit) linking to this bug
in the hope he will see these patches and apply them. They apply only to
the grub git version, tested with latest commit which is currently:
32cd33bd19348afb77ab849846e0b6d6157ea308

In my case I've yet to figure out why kernel panics(attempted to kill
init) but this is gentoo/initramfs issue and thus non-grub related. Grub
loads them both ok, as far as I can tell.

Cheers, I'm out.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to grub2 in Ubuntu.
https://bugs.launchpad.net/bugs/1420584

Title:
  "error: invalid segment."  (with btrfs on LVM on LUKS)

Status in grub2 package in Ubuntu:
  New

Bug description:
  This is an attempt to install grub2 on a system which has boot and root partitions inside a LVM which in turn is all inside a LUKS container (details below at the end).
  Using grub git version (latest of today Feb 11th 2015, I don't know the commit hash)

  The relevant errors are this:
  error: invalid segment.
  grub2-install: error: disk `lvmid/31WF5i-VxBz-zdr3-CbG5-A37g-tbac-qVYGlO/bu7oYe-uBNK-xWYQ-wIZD-fk1K-fBeb-pSkvNO' not found.

  error: invalid segment.
  /usr/sbin/grub2-probe: error: disk `lvmid/31WF5i-VxBz-zdr3-CbG5-A37g-tbac-qVYGlO/sKk47H-AmYx-0iXJ-Tb1a-hy3d-tuaf-ly2AVY' not found.

  Full details below:
  --------

  (chroot1) livecd / # grub2-install --force --compress=xz
  --target=i386-pc --recheck --debug --locales= --fonts= --boot-
  directory=/but --no-rs-codes --modules="part_gpt crypto cryptodisk lvm
  btrfs" -- /dev/sda >/tmp/out.txt 2>&1

  Installing for i386-pc platform.
  grub2-install: info: cannot open `/but/grub/device.map': No such file or directory.
  grub2-install: info: compressing `/usr/lib/grub/i386-pc/disk.mod' -> `/but/grub/i386-pc/disk.mod'.
  [..snip..]
  see attachment for this snipped part, because I got this error(submitting bug):
  The description is too long. If you have lots of text to add, attach a file to the bug instead.
  [..snip..]
  grub2-install: info: drive = -1.
  grub2-install: error: disk `lvmid/31WF5i-VxBz-zdr3-CbG5-A37g-tbac-qVYGlO/bu7oYe-uBNK-xWYQ-wIZD-fk1K-fBeb-pSkvNO' not found.

  (chroot1) livecd / # grub2-mkconfig -o /but/grub/grub.cfg
  >>/tmp/out.txt

  Generating grub configuration file ...
  Found linux image: /but/kernel-genkernel-x86_64-3.19.0-gentoo
  Found initrd image: /but/initramfs-genkernel-x86_64-3.19.0-gentoo
  error: invalid segment.
  /usr/sbin/grub2-probe: error: disk `lvmid/31WF5i-VxBz-zdr3-CbG5-A37g-tbac-qVYGlO/sKk47H-AmYx-0iXJ-Tb1a-hy3d-tuaf-ly2AVY' not found.
  error: invalid segment.
  /usr/sbin/grub2-probe: error: disk `lvmid/31WF5i-VxBz-zdr3-CbG5-A37g-tbac-qVYGlO/sKk47H-AmYx-0iXJ-Tb1a-hy3d-tuaf-ly2AVY' not found.
  error: invalid segment.
  /usr/sbin/grub2-probe: error: disk `lvmid/31WF5i-VxBz-zdr3-CbG5-A37g-tbac-qVYGlO/sKk47H-AmYx-0iXJ-Tb1a-hy3d-tuaf-ly2AVY' not found.
  done

  (chroot1) livecd / # mount
  proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
  udev on /dev type devtmpfs (rw,nosuid,relatime,size=10240k,nr_inodes=1022258,mode=755)
  devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620)
  sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
  tmpfs on /run type tmpfs (rw,nosuid,nodev,relatime,size=818508k,mode=755)
  shm on /dev/shm type tmpfs (rw,nosuid,nodev,noexec,relatime)
  fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
  /dev/mapper/vgall-rootlvol on / type btrfs (rw,relatime,ssd,autodefrag,compress=lzo,datasum,datacow,space_cache,commit=300)
  /dev/mapper/vgall-bootlvol on /but type btrfs (rw,relatime,nosuid,nodev,noexec,ssd,autodefrag,compress=lzo,datasum,datacow,space_cache,commit=300)
  tmpfs on /tmp type tmpfs (rw,nosuid,relatime,nodev,size=7G,mode=1777)
  /tmp on /var/tmp type none (rw,bind,rbind)
  tmpfs on /var/tmp/portage type tmpfs (rw,nosuid,relatime,nodev,size=7G,mode=775,uid=250,gid=250)
  (chroot1) livecd / # lsblk
  NAME                    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
  sda                       8:0    0    25G  0 disk  
  ├─sda1                    8:1    0     2M  0 part  
  └─sda2                    8:2    0    25G  0 part  
    └─lvm_on_luks_on_sda2 253:0    0    25G  0 crypt 
      ├─vgall-bootlvol    253:1    0   128M  0 lvm   /but
      └─vgall-rootlvol    253:2    0  24.9G  0 lvm   /
  sr0                      11:0    1   208M  0 rom   
  loop0                     7:0    0 178.3M  1 loop  

  (chroot1) livecd / # cryptsetup luksDump /dev/sda2 |grep UUID
  UUID:          	b904d6c0-4b05-4c9f-a468-f9242faba2df

  
  (chroot1) livecd / # pvdisplay 
    --- Physical volume ---
    PV Name               /dev/disk/by-id/dm-name-lvm_on_luks_on_sda2
    VG Name               vgall
    PV Size               24.99 GiB / not usable 2.00 MiB
    Allocatable           yes (but full)
    PE Size               4.00 MiB
    Total PE              6398
    Free PE               0
    Allocated PE          6398
    PV UUID               9qjZyk-gLkH-pVXM-B1d6-NpCn-pHH9-mZCfXb
     
  (chroot1) livecd / # vgdisplay 
    --- Volume group ---
    VG Name               vgall
    System ID             
    Format                lvm2
    Metadata Areas        1
    Metadata Sequence No  3
    VG Access             read/write
    VG Status             resizable
    MAX LV                0
    Cur LV                2
    Open LV               2
    Max PV                0
    Cur PV                1
    Act PV                1
    VG Size               24.99 GiB
    PE Size               4.00 MiB
    Total PE              6398
    Alloc PE / Size       6398 / 24.99 GiB
    Free  PE / Size       0 / 0   
    VG UUID               31WF5i-VxBz-zdr3-CbG5-A37g-tbac-qVYGlO
     
  (chroot1) livecd / # lvdisplay 
    --- Logical volume ---
    LV Path                /dev/vgall/bootlvol
    LV Name                bootlvol
    VG Name                vgall
    LV UUID                bu7oYe-uBNK-xWYQ-wIZD-fk1K-fBeb-pSkvNO
    LV Write Access        read/write
    LV Creation host, time livecd, 2015-02-10 04:39:58 +0100
    LV Status              available
    # open                 1
    LV Size                128.00 MiB
    Current LE             32
    Segments               1
    Allocation             inherit
    Read ahead sectors     auto
    - currently set to     256
    Block device           253:1
     
    --- Logical volume ---
    LV Path                /dev/vgall/rootlvol
    LV Name                rootlvol
    VG Name                vgall
    LV UUID                sKk47H-AmYx-0iXJ-Tb1a-hy3d-tuaf-ly2AVY
    LV Write Access        read/write
    LV Creation host, time livecd, 2015-02-10 04:40:02 +0100
    LV Status              available
    # open                 1
    LV Size                24.87 GiB
    Current LE             6366
    Segments               1
    Allocation             inherit
    Read ahead sectors     auto
    - currently set to     256
    Block device           253:2
     

  (chroot1) livecd / # time FEATURES="-stricter" USE="-themes debug mount" emerge -pvq grub
  [ebuild   R   ] sys-boot/grub-9999-r1  USE="debug device-mapper fonts mount multislot -doc -efiemu -libzfs -nls -sdl -static {-test} -themes -truetype" GRUB_PLATFORMS="pc -coreboot -efi-32 -efi-64 -emu -ieee1275 -loongson -multiboot -qemu -qemu-mips -xen" 

  (chroot1) livecd / # fdisk -l /dev/sda

  Disk /dev/sda: 25 GiB, 26843545600 bytes, 52428800 sectors
  Units: sectors of 1 * 512 = 512 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 512 bytes / 512 bytes
  Disklabel type: gpt
  Disk identifier: 5E5F0B83-AE3E-4291-A6C4-35E640505DB8

  Device    Start          End Size Type
  /dev/sda1  2048         6143   2M BIOS boot partition
  /dev/sda2  6144     52426751  25G Linux filesystem

  (chroot1) livecd / # uname -a
  Linux livecd 3.16.5-gentoo #1 SMP Thu Dec 4 06:13:19 UTC 2014 x86_64 AMD A6-3400M APU with Radeon(tm) HD Graphics AuthenticAMD GNU/Linux

  (chroot1) livecd / # cryptsetup --version
  cryptsetup 1.6.6

  (chroot1) livecd / # grub2-install --version
  grub2-install (GRUB) 2.02~beta2

  (chroot1) livecd / # lvm version
    LVM version:     2.02.110(2) (2014-08-26)
    Library version: 1.02.89 (2014-08-26)
    Driver version:  4.27.0

  
  /dev/sda2 is LUKS, then inside it there's LVM (a boot and a root, logical volumes, each of which are btrfs formatter).

  tested inside virtualbox, booted from Gentoo's install-
  amd64-minimal-20141204.iso , chrooted to a
  stage3-amd64-hardened+nomultilib-20150108.tar.bz2

  If anyone is adventurous enough, here's roughly all the steps I followed: https://github.com/emanueLczirai/coostomhuston/blob/7f19d290f1cc170fcf2e5eb47238fb788686e3a5/texts/gentoo_vm.wofl
  (I think only this step is missing: time emerge -av libgcrypt coreutils glibc )

  Note that --force to grub2-install  has no effect(in this grub git
  version), although version from package grub-2.02_beta2-r7:2 (~amd64)
  acts as if --force was given(even though it was not) and both
  grub2-install and grub2-mkconfig do not complain, but upon booting it
  cannot find kernel file.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1420584/+subscriptions



More information about the foundations-bugs mailing list