Bug 1202505 - libblockdev methods do not raise the same exceptions that their devicelibs predecessors did
Summary: libblockdev methods do not raise the same exceptions that their devicelibs pr...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python-blivet
Version: 22
Hardware: x86_64
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: David Lehman
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:bd2d47e60f2d450b36a762e352a...
: 1199021 1202108 1202521 1202532 1203448 (view as bug list)
Depends On:
Blocks: F22BetaBlocker
TreeView+ depends on / blocked
 
Reported: 2015-03-16 18:47 UTC by satellitgo
Modified: 2015-05-19 15:46 UTC (History)
14 users (show)

Fixed In Version: anaconda-22.20.6-1.fc22
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-23 07:10:52 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
File: anaconda-tb (534.49 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: anaconda.log (20.99 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: environ (618 bytes, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: journalctl (236.98 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: lsblk_output (2.48 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: nmcli_dev_list (1.42 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: os_info (443 bytes, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: program.log (53.05 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: storage.log (149.09 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details
File: ifcfg.log (2.27 KB, text/plain)
2015-03-16 18:47 UTC, satellitgo
no flags Details

Description satellitgo 2015-03-16 18:47:40 UTC
Description of problem:
install in VirtualBox to existing install

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

The following was filed automatically by anaconda:
anaconda 22.20.4-1 exception report
Traceback (most recent call first):
  File "/usr/lib/python2.7/site-packages/blivet/devices/lvm.py", line 203, in _teardown
    blockdev.lvm_vgdeactivate(self.name)
  File "/usr/lib/python2.7/site-packages/blivet/devices/storage.py", line 470, in teardown
    self._teardown(recursive=recursive)
  File "/usr/lib/python2.7/site-packages/blivet/devices/device.py", line 211, in teardownParents
    parent.teardown(recursive=recursive)
  File "/usr/lib/python2.7/site-packages/blivet/devices/storage.py", line 476, in _postTeardown
    self.teardownParents(recursive=recursive)
  File "/usr/lib/python2.7/site-packages/blivet/devices/lvm.py", line 643, in _postTeardown
    StorageDevice._postTeardown(self, recursive=recursive)
  File "/usr/lib/python2.7/site-packages/blivet/devices/storage.py", line 471, in teardown
    self._postTeardown(recursive=recursive)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 2215, in teardownAll
    device.teardown(recursive=True)
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 2186, in _populate
    self.teardownAll()
  File "/usr/lib/python2.7/site-packages/blivet/devicetree.py", line 2111, in populate
    self._populate()
  File "/usr/lib/python2.7/site-packages/blivet/blivet.py", line 277, in reset
    self.devicetree.populate(cleanupOnly=cleanupOnly)
  File "/usr/lib/python2.7/site-packages/blivet/osinstall.py", line 1116, 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)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/threads.py", line 112, in wait
    self.raise_if_error(name)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/timezone.py", line 75, in time_initialize
    threadMgr.wait(THREAD_STORAGE)
  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)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/threads.py", line 112, in wait
    self.raise_if_error(name)
  File "/usr/lib64/python2.7/site-packages/pyanaconda/ui/gui/spokes/datetime_spoke.py", line 515, in _initialize
    threadMgr.wait(constants.THREAD_TIME_INIT)
  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)
Error: g-bd-utils-exec-error-quark: Process reported exit code 1280:   Logical volume fedora/swap in use.
  Can't deactivate volume group "fedora" with 1 open logical volume(s)
 (0)

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-KDE-x86_64-22_B-T2 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0 
executable:     /sbin/anaconda
hashmarkername: anaconda
kernel:         4.0.0-0.rc1.git0.1.fc22.x86_64
other involved packages: anaconda-gui-22.20.4-1.fc22.x86_64, python-libs-2.7.9-5.fc22.x86_64, python-blivet-1.0.3-1.fc22.noarch
product:        Fedora"
release:        Fedora release 22 (Twenty Two)
type:           anaconda
version:        Fedora

Comment 1 satellitgo 2015-03-16 18:47:43 UTC
Created attachment 1002449 [details]
File: anaconda-tb

Comment 2 satellitgo 2015-03-16 18:47:43 UTC
Created attachment 1002450 [details]
File: anaconda.log

Comment 3 satellitgo 2015-03-16 18:47:44 UTC
Created attachment 1002451 [details]
File: environ

Comment 4 satellitgo 2015-03-16 18:47:46 UTC
Created attachment 1002452 [details]
File: journalctl

Comment 5 satellitgo 2015-03-16 18:47:47 UTC
Created attachment 1002453 [details]
File: lsblk_output

Comment 6 satellitgo 2015-03-16 18:47:47 UTC
Created attachment 1002454 [details]
File: nmcli_dev_list

Comment 7 satellitgo 2015-03-16 18:47:48 UTC
Created attachment 1002455 [details]
File: os_info

Comment 8 satellitgo 2015-03-16 18:47:49 UTC
Created attachment 1002456 [details]
File: program.log

Comment 9 satellitgo 2015-03-16 18:47:50 UTC
Created attachment 1002457 [details]
File: storage.log

Comment 10 satellitgo 2015-03-16 18:47:51 UTC
Created attachment 1002458 [details]
File: ifcfg.log

Comment 11 mulhern 2015-03-17 14:56:25 UTC
I think that what needs to happen is that each libblockdev calls needs to be wrapped in a context manager that translates GError that might be raised to error that was previously raise by devicelibs method. For example, the error in this bug would be caught in devicetree.teardownAll if it were an LVM error which is a subclass of StorageError, but it just propagates, because it is a GError.

Comment 12 mulhern 2015-03-17 16:53:35 UTC
dlehman has suggested some alternative that handles the problem on the libblockdev side, as it is preferred to avoid wrapping every blockdev method call in a context manager. The idea he suggested is that blockdev should raise a distinct error for each different plugin name and should have a superclass error like BlockDevError. In this approach, work would have to be done on blivet as well, to properly catch the exceptions from the new exception hierarchy.

If this approach is taken, then it would be desirable if an exception were also raised by the methods if the application on which the method depended was unavailable. If not, then it would probably be necessary to wrap each blockdev call in a context manager anyway, so the benefit of the other work, at least in terms of avoiding lots of context manager use, would be lost.

Comment 13 David Shea 2015-03-17 18:24:57 UTC
*** Bug 1202521 has been marked as a duplicate of this bug. ***

Comment 14 David Shea 2015-03-17 18:25:19 UTC
*** Bug 1202532 has been marked as a duplicate of this bug. ***

Comment 15 David Shea 2015-03-17 18:25:21 UTC
*** Bug 1202108 has been marked as a duplicate of this bug. ***

Comment 16 David Shea 2015-03-17 19:15:29 UTC
*** Bug 1199021 has been marked as a duplicate of this bug. ***

Comment 17 Adam Williamson 2015-03-17 22:23:11 UTC
Another user experienced a similar problem:

Happens on launch of liveinst from a Workstation live built from current F22 stable plus anaconda 22.20.5 , blivet 1.0.4 , and libblockdev 0.7 (the packages we were intending to use for TC3). Looks like a showstopper for live installs.

cmdline:        /usr/bin/python2  /sbin/anaconda --liveinst --method=livecd:///dev/mapper/live-base
cmdline_file:   BOOT_IMAGE=vmlinuz0 initrd=initrd0.img root=live:CDLABEL=20150317-ws-x86_64 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0 
hashmarkername: anaconda
kernel:         4.0.0-0.rc1.git0.1.fc22.x86_64
other involved packages: python-blivet-1.0.4-1.fc22.noarch, python-libs-2.7.9-5.fc22.x86_64
package:        anaconda-core-22.20.5-1.fc22.x86_64
packaging.log:  
product:        Fedora"
release:        Fedora release 22 (Twenty Two)
version:        Fedora

Comment 18 Adam Williamson 2015-03-17 22:25:28 UTC
As this seems to prevent anaconda running at all from a live image with a standard existing installation, nominating as a Beta blocker:

"Cleanly install to a disk with a valid ms-dos or gpt disk label and partition table which contains existing data and sufficient unpartitioned space for a Fedora installation"

(or various other criteria, but that's fine). https://fedoraproject.org/wiki/Fedora_22_Beta_Release_Criteria#Guided_partitioning

Comment 19 Joachim Frieben 2015-03-18 06:10:51 UTC
(In reply to awilliam from comment #18)
As a workaround you can disable swap files/partitions by means of 'swapoff -a'. the installer then proceeds as expected. However, after the install, I then had to enable swap space in /etc/fstab of the new system on the system disk.

Comment 20 Vratislav Podzimek 2015-03-18 08:44:19 UTC
I see three issues here:
1) blivet tears down devices in a wrong order/way since it tries to deactivate a VG that has an active LV which has an active swap on it
2) if one parent of a device fails to tear down, no other parent is even attempted to be torn down
3) blivet doesn't catch the GLib.Error when it is raised because of 1)

While 1) would be quite hard and expensive to resolve and is not a big issue if other things work well, I think both 2) and 3) should be fixed. 2) is easy to fix, 3) is a bit more complicated.

For 3) I'd suggest starting with a oneliner that would add the GLib.Error to the 'except' part of the try-except block in devicetree.teardownAll() which would resolve this particular, serious, issue. Then we could add some code to libblockdev's GI overrides that would wrap these functions into something like 'BlockDevError' (and inherited classes like LVMError, SwapError,...) and replace GLib.Error with such exception class in devicetree.teardownAll() and in other places in blivet.

What is basically impossible (everything is possible in python with ugly enough hacks) to do is to have libblockdev raise exceptions inherited from blivet's StorageError.

Comment 21 Joachim Frieben 2015-03-18 10:25:20 UTC
Installing Fedora 22 using the Beta TC2 boot image completes flawlessly. However, when booting into the new system, it turns out that swap space is disabled. The corresponding entry in /etc/fstab reads:

/dev/mapper/VolGroup00-LogVol03 swap    swap    pri=-1    0 0

This was reported before in comment 19 albeit thought to be related to executing 'swapoff -a' in a running live system before launching the installer to work around bug 1199021. After replacing "pri=-1" by "defaults" and restarting the system, swap space is enabled as expected.

Comment 22 Vratislav Podzimek 2015-03-18 14:58:14 UTC
(In reply to Joachim Frieben from comment #21)
> Installing Fedora 22 using the Beta TC2 boot image completes flawlessly.
> However, when booting into the new system, it turns out that swap space is
> disabled. The corresponding entry in /etc/fstab reads:
> 
> /dev/mapper/VolGroup00-LogVol03 swap    swap    pri=-1    0 0
> 
> This was reported before in comment 19 albeit thought to be related to
> executing 'swapoff -a' in a running live system before launching the
> installer to work around bug 1199021. After replacing "pri=-1" by "defaults"
> and restarting the system, swap space is enabled as expected.
This is a different bug, please create it and assign it to me.

Comment 23 Vratislav Podzimek 2015-03-18 15:05:15 UTC
Guys, could you please test the following updates.img?
http://vpodzime.fedorapeople.org/1202505_updates.img

It should contain fixes for both issues reported above.

Comment 24 Vratislav Podzimek 2015-03-18 15:24:12 UTC
Created https://github.com/rhinstaller/blivet/pull/52 and https://github.com/rhinstaller/blivet/pull/53 with patches.

Comment 25 Adam Williamson 2015-03-18 15:49:35 UTC
Another user experienced a similar problem:

Running a current F22 live (testing some bug report submission stuff for openQA)

cmdline:        /usr/bin/python2  /sbin/anaconda --liveinst --method=livecd:///dev/mapper/live-base --updates=http://vpodzime.fedorapeople.org/1202505_updates.img
cmdline_file:   BOOT_IMAGE=vmlinuz0 initrd=initrd0.img root=live:CDLABEL=20150317-ws-x86_64 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0 
hashmarkername: anaconda
kernel:         4.0.0-0.rc1.git0.1.fc22.x86_64
other involved packages: python-blivet-1.0.4-1.fc22.noarch, python-libs-2.7.9-5.fc22.x86_64
package:        anaconda-core-22.20.5-1.fc22.x86_64
product:        Fedora"
release:        Fedora release 22 (Twenty Two)
version:        Fedora

Comment 26 Adam Williamson 2015-03-18 15:55:01 UTC
The updates.img is no good for the 'crash on liveinst run' case because the crash actually happens before updates.img is applied, but I'll test it by applying the patches directly before running liveinst.

Comment 27 Adam Williamson 2015-03-18 16:01:39 UTC
I applied the two patches submitted for review directly before running an install, and that does indeed fix the liveinst crash. +1

Comment 28 David Shea 2015-03-18 21:12:24 UTC
*** Bug 1203448 has been marked as a duplicate of this bug. ***

Comment 29 Vratislav Podzimek 2015-03-19 14:35:05 UTC
Patches from https://github.com/rhinstaller/blivet/pull/53 were pushed to the f22-branch.

Comment 30 Fedora Update System 2015-03-19 18:21:31 UTC
anaconda-22.20.6-1.fc22, python-blivet-1.0.5-1.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/python-blivet-1.0.5-1.fc22,anaconda-22.20.6-1.fc22

Comment 31 Lukas Brabec 2015-03-20 06:40:27 UTC
Another user experienced a similar problem:

Just started "Install to Hard Drive" from live F22 Beta TC2

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_B-T2 rootfstype=auto ro rd.live.image quiet  rhgb rd.luks=0 rd.md=0 rd.dm=0 
hashmarkername: anaconda
kernel:         4.0.0-0.rc1.git0.1.fc22.x86_64
other involved packages: python-libs-2.7.9-5.fc22.x86_64, python-blivet-1.0.3-1.fc22.noarch
package:        anaconda-core-22.20.4-1.fc22.x86_64
packaging.log:  
product:        Fedora"
release:        Fedora release 22 (Twenty Two)
version:        Fedora

Comment 32 Lukas Brabec 2015-03-20 08:12:24 UTC
(In reply to Fedora Update System from comment #30)
> anaconda-22.20.6-1.fc22, python-blivet-1.0.5-1.fc22 has been submitted as an
> update for Fedora 22.
> https://admin.fedoraproject.org/updates/python-blivet-1.0.5-1.fc22,anaconda-
> 22.20.6-1.fc22

This fixed the problem.

Comment 33 Fedora Update System 2015-03-21 05:03:25 UTC
Package anaconda-22.20.6-1.fc22, python-blivet-1.0.5-1.fc22, libblockdev-0.7-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.6-1.fc22 python-blivet-1.0.5-1.fc22 libblockdev-0.7-1.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-4351/libblockdev-0.7-1.fc22,python-blivet-1.0.5-1.fc22,anaconda-22.20.6-1.fc22
then log in and leave karma (feedback).

Comment 34 Fedora Update System 2015-03-23 07:10:52 UTC
anaconda-22.20.6-1.fc22, python-blivet-1.0.5-1.fc22, libblockdev-0.7-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.