grub-probe takes snapshot LV instead of origin
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | grub2 (Ubuntu) |
Undecided
|
Unassigned | ||
| | linux (Ubuntu) |
Medium
|
Unassigned | ||
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@thinkpad:~# mount | grep " / "
/dev/mapper/
root@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@thinkpad:~# grub-probe --target=device /
/dev/mapper/
The most apparent reason could be that obviously the UUIDs of the origin and the snapshot are the same.
root@thinkpad:~# blkid /dev/thinkvg/
/dev/thinkvg/
/dev/thinkvg/
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@thinkpad:~# rm /dev/thinkvg/
root@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/
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.
| Phillip Susi (psusi) wrote : | #1 |
| MegaBrutal (qbu6to) wrote : | #2 |
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.
| Phillip Susi (psusi) wrote : | #3 |
So /proc/mounts lists the snapshot as the root... what does /proc/cmdline say?
| MegaBrutal (qbu6to) wrote : | #4 |
The kernel is not being rebooted meanwhile, so /proc/cmdline, so it still states the original device as root.
For example:
root=/dev/vg/rootlv rootflags=subvol=@ ro
| Phillip Susi (psusi) wrote : | #5 |
If /proc/mounts lists the wrong device, then that certainly is a kernel bug.
This bug is missing log files that will aid in diagnosing the problem. From a terminal window please run:
apport-collect 1391429
and then change the status of the bug to 'Confirmed'.
If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.
This change has been made by an automated script, maintained by the Ubuntu Kernel Team.
| Changed in linux (Ubuntu): | |
| status: | New → Incomplete |
| Changed in linux (Ubuntu): | |
| status: | Incomplete → Confirmed |
| Joseph Salisbury (jsalisbury) wrote : | #7 |
Would it be possible for you to test the latest upstream kernel? Refer to https:/
If this bug is fixed in the mainline kernel, please add the following tag 'kernel-
If the mainline kernel does not fix this bug, please add the tag: 'kernel-
If you are unable to test the mainline kernel, for example it will not boot, please add the tag: 'kernel-
Once testing of the upstream kernel is complete, please mark this bug as "Confirmed".
Thanks in advance.
[0] http://
| MegaBrutal (qbu6to) wrote : | #8 |
I've tested with 3.18.0-
| tags: | added: kernel-bug-exists-upstream |
| MegaBrutal (qbu6to) wrote : | #9 |
I've built a system to reproduce the bug. You can download the image and run it with KVM or other virtualization technology. Instructions are straightforward – if you start the VM, you'll know what to do, and you'll see what I was talking about.
http://
Download size: 113 MB; Unpacked image size: 2 GB.
| Changed in linux (Ubuntu): | |
| status: | Confirmed → Triaged |
| Changed in grub2 (Ubuntu): | |
| status: | New → Invalid |
| Changed in linux (Ubuntu): | |
| importance: | Undecided → Medium |
| MegaBrutal (qbu6to) wrote : | #10 |
Reported upstream to BTRFS developers:
https:/


Grub does ignore snapshots... what does cat /proc/mounts say?