Bug 1201120 - DeviceTreeError: could not find parent for subvol
Summary: DeviceTreeError: could not find parent for subvol
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: libblockdev
Version: 22
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Vratislav Podzimek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:70f3aa2f7e03e6cb25f7637f2da...
Depends On:
Blocks: F22BetaBlocker
TreeView+ depends on / blocked
 
Reported: 2015-03-12 04:40 UTC by Ravi Terala
Modified: 2015-04-04 17:52 UTC (History)
14 users (show)

Fixed In Version: anaconda-22.20.7-1.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-04-04 17:52:43 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: anaconda-tb (810.87 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: anaconda.log (14.44 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: environ (590 bytes, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: journalctl (426.76 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: lsblk_output (4.21 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: nmcli_dev_list (2.24 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: os_info (443 bytes, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: program.log (108.33 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: storage.log (176.96 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
File: ifcfg.log (4.10 KB, text/plain)
2015-03-12 04:40 UTC, Ravi Terala
no flags Details
Btrfs subvol list (16.03 KB, text/plain)
2015-03-20 02:48 UTC, Ravi Terala
no flags Details

Description Ravi Terala 2015-03-12 04:40:21 UTC
Description of problem:
I have several btrfs volumes, one with lots of docker snapshots. Anaconda crashed while trying to enumerate these volumes.

Version-Release number of selected component:
anaconda-core-22.20.2-1.fc22.x86_64

The following was filed automatically by anaconda:
anaconda 22.20.2-1 exception report
Traceback (most recent call first):
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1736, in handleBTRFSFormat
    raise DeviceTreeError("could not find parent for subvol")
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1883, in handleUdevDeviceFormat
    self.handleBTRFSFormat(info, device)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 1258, in addUdevDevice
    self.handleUdevDeviceFormat(info, device)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 2177, in _populate
    self.addUdevDevice(dev)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 2111, in populate
    self._populate()
  File "/usr/lib/python2.7/site-packages/blivet/__init__.py", line 372, in reset
    self.devicetree.populate(cleanupOnly=cleanupOnly)
  File "/usr/lib/python2.7/site-packages/blivet/osinstall.py", line 1128, in storageInitialize
    storage.reset()
  File "/usr/lib64/python2.7/threading.py", line 766, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/threads.py", line 238, in run
    threading.Thread.run(self, *args, **kwargs)
DeviceTreeError: could not find parent for subvol

Additional info:
cmdline:        /usr/bin/python2  /sbin/anaconda --liveinst --method=livecd:///dev/mapper/live-base
cmdline_file:   BOOT_IMAGE=vmlinuz0 initrd=initrd0.img root=live:CDLABEL=Fedora-Live-WS-x86_64-22_A-3 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0 nomodeset
executable:     /sbin/anaconda
hashmarkername: anaconda
kernel:         4.0.0-0.rc1.git0.1.fc22.x86_64
other involved packages: python-blivet-1.0-1.fc22.noarch, python-libs-2.7.9-5.fc22.x86_64
product:        Fedora"
release:        Fedora release 22 (Twenty Two)
type:           anaconda
version:        Fedora

Comment 1 Ravi Terala 2015-03-12 04:40:24 UTC
Created attachment 1000765 [details]
File: anaconda-tb

Comment 2 Ravi Terala 2015-03-12 04:40:25 UTC
Created attachment 1000766 [details]
File: anaconda.log

Comment 3 Ravi Terala 2015-03-12 04:40:26 UTC
Created attachment 1000767 [details]
File: environ

Comment 4 Ravi Terala 2015-03-12 04:40:27 UTC
Created attachment 1000768 [details]
File: journalctl

Comment 5 Ravi Terala 2015-03-12 04:40:28 UTC
Created attachment 1000769 [details]
File: lsblk_output

Comment 6 Ravi Terala 2015-03-12 04:40:29 UTC
Created attachment 1000770 [details]
File: nmcli_dev_list

Comment 7 Ravi Terala 2015-03-12 04:40:30 UTC
Created attachment 1000771 [details]
File: os_info

Comment 8 Ravi Terala 2015-03-12 04:40:31 UTC
Created attachment 1000772 [details]
File: program.log

Comment 9 Ravi Terala 2015-03-12 04:40:32 UTC
Created attachment 1000773 [details]
File: storage.log

Comment 10 Ravi Terala 2015-03-12 04:40:32 UTC
Created attachment 1000774 [details]
File: ifcfg.log

Comment 11 Chris Murphy 2015-03-13 16:47:54 UTC
"DeviceTreeError: could not find parent for subvol"

What parent does this refer to? Subvols, including snapshots, aren't guaranteed to have a parent.

Comment 12 Fedora Blocker Bugs Application 2015-03-13 16:56:17 UTC
Proposed as a Blocker for 22-beta by Fedora user chrismurphy using the blocker tracking app because:

 When using the custom partitioning flow, the installer must be able to: Correctly interpret ... btrfs volumes.

Comment 13 Adam Williamson 2015-03-16 16:26:05 UTC
There's a slightly more detailed version of the error logged to storage.log:

21:35:55,899 ERR blivet: failed to find parent (328) for subvol home/ravi

the code is:

https://github.com/dwlehman/blivet/blob/f22-branch/blivet/devicetree.py#L1715-L1736

Comment 14 Dan Mossor [danofsatx] 2015-03-16 17:45:13 UTC
Discussed at Fedora Blocker Review Meeting 2015-03-16[0]:

Punt - The QA team would like some more details on reproducing this bug to get more testing before voting on it's blocker status.

[0]: http://meetbot.fedoraproject.org/fedora-blocker-review/2015-03-16/f22-blocker-review.2015-03-16-16.01.log.txt

Comment 15 Chris Murphy 2015-03-16 17:49:59 UTC
(In reply to Adam Williamson (Red Hat) from comment #13)
Entirely plausible the "parent" was deleted, possibly a long time ago. I'm not following the code quickly or well enough to understand the purpose of this distinction.
1742                    device_class = BTRFSSnapShotDevice
1743                else:
1744                    device_class = BTRFSSubVolumeDevice
Btrfs doesn't have such a distinction. A snapshot is a subvolume. The user space tools have a superficial distinction due to metadata it tracks, e.g.:
	Name: 			root
	uuid: 			9e1bc058-24f9-164c-b71e-b4f8da3e2c06
	Parent uuid: 		-
---
	Name: 			rootsnap
	uuid: 			593cfa3b-7174-bd4a-ab58-bfbec6e97d82
	Parent uuid: 		9e1bc058-24f9-164c-b71e-b4f8da3e2c06

But I can delete either of these without affecting the other. So it's legit for me to delete the first one, leaving the 2nd one with a parent uuid that no longer exists.

Comment 16 Ravi Terala 2015-03-16 18:14:21 UTC
If you need any specific info from me, please let me know so I can get it for you. At a minimum, it should let the install proceed and let the user select which ever subvolume/drives to install to so he can proceed with the installation. Complete crash should not be acceptable. There is no fallback at all right now.

Comment 17 Chris Murphy 2015-03-16 18:20:19 UTC
(In reply to Ravi Terala from comment #16)
What do you get for:
# btrfs subvolume list -apt /mnt
If ID 328 isn't listed, can you give an idea what happened? Was it deleted?

Comment 18 David Lehman 2015-03-16 19:36:28 UTC
Running... btrfs subvol list -p /tmp/btrfs-tmp.106uMZp8o
stdout:
ID 257 gen 26934 parent 328 top level 328 path home/ravi
ID 258 gen 25435 parent 328 top level 328 path home/aniketh
ID 327 gen 26852 parent 5 top level 5 path docker
ID 328 gen 23724 parent 5 top level 5 path home
<lots of snapshots omitted>

So the problem is that the output is sorted by id while the dependencies are determined by path/name. Blivet either needs to sort the subvols by path before trying to add them or expand the code that adds them to allow on-demand addition like we do for lvm. Or we could use blivet.tsort to determine an appropriate order.

Comment 19 Vratislav Podzimek 2015-03-18 20:21:43 UTC
I think this should fix the issue: http://paste.fedoraproject.org/199765/67100321/

Comment 20 Vratislav Podzimek 2015-03-18 20:32:12 UTC
(In reply to Vratislav Podzimek from comment #19)
> I think this should fix the issue:
> http://paste.fedoraproject.org/199765/67100321/
To easily test the change, could somebody please try running:

# btrfs subvol list -p --sort=path /tmp/btrfs-tmp.106uMZp8o

on the affected system and post the result here?

Comment 21 Ravi Terala 2015-03-20 02:48:56 UTC
Created attachment 1004261 [details]
Btrfs subvol list

btrfs sub volume list as requested.

Comment 22 Vratislav Podzimek 2015-03-20 08:25:02 UTC
(In reply to Ravi Terala from comment #21)
> Created attachment 1004261 [details]
> Btrfs subvol list
> 
> btrfs sub volume list as requested.
Hmm, this is what we need:
> ID 327 gen 28249 parent 5 top level 5 path docker
> ID 328 gen 26961 parent 5 top level 5 path home
> ID 258 gen 25435 parent 328 top level 328 path home/aniketh
> ID 257 gen 28257 parent 328 top level 328 path home/ravi

But all the btrfs/subvolumes/* subvolumes (snapshots, I guess?) whose path doesn't start with the parent's path ("docker") would cause the same issues as the "home/ravi" in this first case.

So this needs a more complex solution.

Comment 23 Adam Williamson 2015-03-23 17:47:11 UTC
Discussed at 2015-03-23 blocker review meeting: http://meetbot.fedoraproject.org/fedora-blocker-review/2015-03-23/f22-blocker-review.2015-03-23-16.02.log.txt . Accepted as a Beta blocker per criterion cited in #c12.

Comment 24 Vratislav Podzimek 2015-03-24 18:23:12 UTC
A fix tested on data extracted from this bug report:
https://github.com/rhinstaller/libblockdev/pull/6

Comment 25 Vratislav Podzimek 2015-03-24 18:42:34 UTC
This should be resolved in libblockdev, I think.

Comment 26 Vratislav Podzimek 2015-03-24 19:05:25 UTC
scratch build with the changes included:
http://koji.fedoraproject.org/koji/taskinfo?taskID=9312774

Ravi, could you please try running the installation with the RPMs from the above build installed?

Comment 27 Ravi Terala 2015-03-24 20:19:33 UTC
I booted with with USB key last time. Can you provide me instructions on how to use these bits?

Comment 28 Vratislav Podzimek 2015-03-25 08:13:32 UTC
(In reply to Ravi Terala from comment #27)
> I booted with with USB key last time. Can you provide me instructions on how
> to use these bits?
Unfortunately, neither 'bodhi -D 9312774' nor 'koji download-build 9312774' work in F22, so here's the stupid thing you'd have to do to update libblockdev to the should-be-fixed version:

$ sudo dnf update https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-btrfs-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-crypto-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-dm-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-loop-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-lvm-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-mdraid-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-mpath-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-plugins-all-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-swap-0.7-1_rhbz_1201120.fc22.x86_64.rpm https://kojipkgs.fedoraproject.org//work/tasks/2774/9312774/libblockdev-utils-0.7-1_rhbz_1201120.fc22.x86_64.rpm

Comment 29 Adam Williamson 2015-03-25 18:40:25 UTC
There's a 'koji-download-scratch' command which, for reasons that i'm sure made sense at the time, lives in fedora-review...

Ravi, if the bug is reproducible from a live image, all you need to do is boot the live image, update the libblockdev packages from the scratch build, then run the install. It's possible to update and install packages in a live image, at least until you run out of RAM.

If it's only reproducible from a non-live installer image, it's a bit trickier, we'll have to build you a custom one with the new libblockdev included. If you need that, let me know, and I'll do it. Thanks!

Comment 30 Fedora Update System 2015-03-30 15:36:40 UTC
anaconda-22.20.7-1.fc22, libblockdev-0.8-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/FEDORA-2015-4952/libblockdev-0.8-1.fc22,anaconda-22.20.7-1.fc22

Comment 31 Fedora Update System 2015-03-31 21:42:51 UTC
Package anaconda-22.20.7-1.fc22, libblockdev-0.8-1.fc22:
* should fix your issue,
* was pushed to the Fedora 22 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing anaconda-22.20.7-1.fc22 libblockdev-0.8-1.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-4952/libblockdev-0.8-1.fc22,anaconda-22.20.7-1.fc22
then log in and leave karma (feedback).

Comment 32 Adam Williamson 2015-04-01 23:23:58 UTC
Ravi, the fix for this should be in Beta TC6; can you please test and let us know? Thanks!

https://dl.fedoraproject.org/pub/alt/stage/22_Beta_TC6/

Comment 33 Ravi Terala 2015-04-02 15:59:43 UTC
I've updated the libblockdev and anaconda as suggested and ran the live installer. The bug is now fixed and it takes me to the selection place correctly.

Comment 34 Adam Williamson 2015-04-02 16:26:15 UTC
Thanks a lot for testing! Marking as VERIFIED.

Comment 35 Fedora Update System 2015-04-04 17:52:43 UTC
anaconda-22.20.7-1.fc22, libblockdev-0.8-1.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.