PackageKit fails with error "pct = div * (ts_current - 1) + pct_start + ((div / 100.0) * val)"
Environment
- Red Hat Enterprise Linux 6
- PackageKit-0.5.8-21.el6.x86_64
- yum-3.2.29-43.el6_5.noarch
Issue
- PackageKit sometimes fails with the following traceback.
An internal system error has occurred
A problem that we were not expecting has occurred.
Please report this bug in your distribution bugtracker with
the error description.
More details
Error Type: <type 'exceptions.UnboundLocalError'>
Error Value: local variable 'val' referenced before assignment
File : /usr/lib/python2.6/site-packages/yum/rpmtrans.py, line 401, in callback
self._instProgress( bytes, total, h )
File : /usr/lib/python2.6/site-packages/yum/rpmtrans.py, line 493, in _instProgress
self.complete_actions, self.total_actions)
File : /usr/share/PackageKit/helpers/yum/yumBackend.py, line 3041, in event
pct = div * (ts_current - 1) + pct_start + ((div / 100.0) * val)
Resolution
- This has been fixed by an Errata RHBA-2015-1352
- If update is not possible, use the following workaround.
Workaround
- Script:
/usr/share/PackageKit/helpers/yum/yumBackend.py
- When launched by the
PackageKit
GUI to update packages, flags an error at line 3041 that"val"
is being used before assignment. This causes the yum transaction to fail partway through, and does not recover until"yum-complete-transaction"
is launched to either complete, or clean remaining transactions. - The actual error is a few lines above, where
val
is set conditionally, with no default.
# do subpercentage
if te_total > 0:
val = (te_current*100L)/te_total
self.base.sub_percentage(val)
- This fragment should read:
# do subpercentage
if te_total > 0:
val = (te_current*100L)/te_total
else:
val = 0
self.base.sub_percentage(val)
- After making the above change and compiling with
"python -m py_compile /usr/share/PackageKit/helpers/yum/yumBackend.py"
, thePackageKit
GUI is able to complete transactions successfully.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments