[Bug 1391429] Re: grub-probe takes snapshot LV instead of origin

MegaBrutal ubuntu at megabrutal.com
Sun Nov 16 21:15:21 UTC 2014


I made some experiments and could only reproduce the problem with btrfs file system.
And /proc/mounts says the root file system is the snapshot. This is rather strange.
Probably it's a btrfs bug and nothing to do with grub-probe.

To reproduce:
1. Create an LV, format it to btrfs.
2. Mount the LV, create subvolume '@' on the file system.
3. debootstrap a base system to the subvolume.
4. chroot to the subvolume, do whatever it takes to make it bootable (install kernel, lvm2, btrfs-tools).
5. Boot the new system.
6. Create an LVM-snapshot of the root LV.
7. 'grub-probe --target=device /' will tell you that your root device is the snapshot.

-- 
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/1391429

Title:
  grub-probe takes snapshot LV instead of origin

Status in “grub2” package in Ubuntu:
  New

Bug description:
  grub-probe takes the snapshot of my root LV as if it was the legitimate root device.
  This is an issue because in any case an update-grub / grub-mkconfig runs, my GRUB config will be rewritten so that the system would boot from the snapshot. This is really undesirable.

  root at thinkpad:~# mount | grep " / "
  /dev/mapper/thinkvg-rootlv on / type btrfs (rw,subvol=@)

  root at thinkpad:~# lvs
    LV          VG      Attr      LSize  Pool Origin Data%  Move Log Copy%  Convert
    homelv      thinkvg -wi-ao--- 64,00g                                           
    rootlv      thinkvg owi-aos-- 16,00g                                           
    snap-rootlv thinkvg sri-a-s-- 16,00g      rootlv   2,54                        
    swap0       thinkvg -wi-ao---  2,00g                                           
    swap1       thinkvg -wi-ao---  2,00g

  root at thinkpad:~# grub-probe --target=device /
  /dev/mapper/thinkvg-snap--rootlv

  The most apparent reason could be that obviously the UUIDs of the
  origin and the snapshot are the same.

  root at thinkpad:~# blkid /dev/thinkvg/*rootlv
  /dev/thinkvg/rootlv: LABEL="SystemRoot" UUID="dd6904ff-d187-43a8-ae18-478283f29d68" UUID_SUB="80b3d748-51e0-4a51-a021-55005b0ec434" TYPE="btrfs" 
  /dev/thinkvg/snap-rootlv: LABEL="SystemRoot" UUID="dd6904ff-d187-43a8-ae18-478283f29d68" UUID_SUB="80b3d748-51e0-4a51-a021-55005b0ec434" TYPE="btrfs" 

  However, strangely, if I hide the snapshot by deleting nodes (as I
  can't deactivate a snapshot without deactivating its origin too – lost
  nodes will come back after reboot, or sometimes can be recovered with
  "vgscan --mknodes"), grub-probe won't find any device:

  root at thinkpad:~# rm /dev/thinkvg/snap-rootlv /dev/mapper/thinkvg-snap--rootlv /dev/dm-5
  root at thinkpad:~# grub-probe --target=device /
  grub-probe: error: cannot find a device for / (is /dev mounted?).

  I'd expect grub-probe to find /dev/mapper/thinkvg-rootlv, and ignore
  the snapshot.

  For me, it serves as an evidence that grub-probe totally ignores LVM,
  or at least makes no attempt to differentiate snapshots from origins,
  while LV snapshots are easily recognized from their "s" flag.

  The same thing happened when I manually cloned the root LV as "backup-
  rootlv", though since it was created with simply dd-ing "rootlv" over,
  the LVs were not related on LVM level, thus grub-probe legitimately
  treated it as a stand-alone device that has the same file system as
  the one being mounted.

  Still, it would be best is grub-probe found the device that is
  actually mounted, no matter what clones of the device exist. But at
  least it should certainly ignore LVM snapshots.

  I experienced this bug on 2 systems: on Trusty Tahr and on Utopic
  Unicorn.

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



More information about the foundations-bugs mailing list