Bug 1249379 - dnf downgrade of a broken package may leave package uninstalled
dnf downgrade of a broken package may leave package uninstalled
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
22
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Honza Silhan
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-02 03:58 EDT by Ville Skyttä
Modified: 2015-08-19 03:51 EDT (History)
8 users (show)

See Also:
Fixed In Version: dnf-plugins-core-0.1.10-1.fc23
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-08-14 22:13:57 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ville Skyttä 2015-08-02 03:58:59 EDT
# rpm -q dnf webkitgtk4
dnf-1.0.2-3.fc22.noarch  # from current updates-testing
webkitgtk4-2.8.4-3.fc22.x86_64

I had a broken earlier webkitgtk4 package downloaded, you can get one for example with:

curl -O -r 0-3000000 https://kojipkgs.fedoraproject.org//packages/webkitgtk4/2.8.4/2.fc22/x86_64/webkitgtk4-2.8.4-2.fc22.x86_64.rpm

This has nothing to do with webkitgtk4 in particular, it's just used as an example. I didn't notice it broken and tried to downgrade to it with dnf:

--------------------
# dnf -y downgrade ./webkitgtk4-2.8.4-2.fc22.x86_64.rpm
[...]
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Downgrading : webkitgtk4-2.8.4-2.fc22.x86_64
Error unpacking rpm package webkitgtk4-2.8.4-2.fc22.x86_64
error: unpacking of archive failed on file /usr/lib64/libwebkit2gtk-4.0.so.37.6.7;55bdcb5e: cpio: read
  Erasing     : webkitgtk4-2.8.4-3.fc22.x86_64
error: webkitgtk4-2.8.4-2.fc22.x86_64: install failed
webkitgtk4-2.8.4-2.fc22.x86_64 was supposed to be installed but is not!
  Verifying   : webkitgtk4-2.8.4-2.fc22.x86_64
  Verifying   : webkitgtk4-2.8.4-3.fc22.x86_64

Downgraded:
  webkitgtk4.x86_64 2.8.4-2.fc22                                                                                                    

Complete!
--------------------

There are two troubling things with this:

First, the output says Downgraded, but the package was not actually downgraded.

Second, and more importantly, the webkitgtk4 package is no longer installed at all as far as rpmdb is concerned:
    # rpm -q webkitgtk4
    package webkitgtk4 is not installed
And obviously I now have some broken dependencies but was not notified about them.

Not sure what exactly should/could be done about this, but I do think *something* should be done, maybe at least skip the erase step. Plain rpm doesn't work perfectly either in this scenario where I try to downgrade the same broken package with it (some files are upgraded, some not), but at least it doesn't leave the package uninstalled:

# rpm -U --oldpackage webkitgtk4-2.8.4-2.fc22.x86_64.rpm 
error: unpacking of archive failed on file /usr/lib64/libwebkit2gtk-4.0.so.37.6.7;55bdccc2: cpio: read
error: webkitgtk4-2.8.4-2.fc22.x86_64: install failed
error: webkitgtk4-2.8.4-3.fc22.x86_64: erase skipped
# rpm -q webkitgtk4
webkitgtk4-2.8.4-3.fc22.x86_64
Comment 1 Ville Skyttä 2015-08-02 04:00:10 EDT
BTW I'm not sure this happens just with downgrade or if upgrade is affected too -- I haven't tested anything but downgrade.
Comment 2 Honza Silhan 2015-08-11 11:26:31 EDT
DNF uses this sequence for downgrade:

ts.addErase(tsi.erased.idx)
hdr = tsi.installed.header
ts.addInstall(hdr, tsi, 'i')

Maybe that's why it remove the package first and then install the downgrade.
Lubos, does rpm downgrade the package differently through internal functions. I would expect there addDowngrade function analogue to addInstall, addErase and addReinstall.
Comment 3 Ľuboš Kardoš 2015-08-12 11:11:07 EDT
You should use this sequence for downgrade:

ts.addErase(tsi.erased.idx)
hdr = tsi.installed.header
ts.addInstall(hdr, tsi, 'u')
Comment 4 Honza Silhan 2015-08-12 11:24:57 EDT
Thanks Lubos.
Fixed in the upstream: https://github.com/rpm-software-management/dnf/commit/564f90e3941c402eb63b70c5ba9d89ace65d8135
Comment 5 Fedora Update System 2015-08-13 04:17:06 EDT
dnf-plugins-core-0.1.10-1.fc22, hawkey-0.6.0-1.fc22, dnf-1.1.0-2.fc22 has been submitted as an update for Fedora 22.
https://admin.fedoraproject.org/updates/FEDORA-2015-13162/dnf-plugins-core-0.1.10-1.fc22,dnf-1.1.0-2.fc22,hawkey-0.6.0-1.fc22
Comment 6 Fedora Update System 2015-08-13 04:17:14 EDT
dnf-plugins-core-0.1.10-1.fc23, hawkey-0.6.0-1.fc23, dnf-1.1.0-2.fc23 has been submitted as an update for Fedora 23.
https://admin.fedoraproject.org/updates/FEDORA-2015-13289/dnf-plugins-core-0.1.10-1.fc23,dnf-1.1.0-2.fc23,hawkey-0.6.0-1.fc23
Comment 7 Fedora Update System 2015-08-13 12:55:14 EDT
Package dnf-plugins-core-0.1.10-1.fc22, hawkey-0.6.0-1.fc22, dnf-1.1.0-2.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 dnf-plugins-core-0.1.10-1.fc22 hawkey-0.6.0-1.fc22 dnf-1.1.0-2.fc22'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2015-13162/dnf-plugins-core-0.1.10-1.fc22,dnf-1.1.0-2.fc22,hawkey-0.6.0-1.fc22
then log in and leave karma (feedback).
Comment 8 Fedora Update System 2015-08-14 22:13:57 EDT
dnf-plugins-core-0.1.10-1.fc22, hawkey-0.6.0-1.fc22, dnf-1.1.0-2.fc22 has been pushed to the Fedora 22 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 9 Fedora Update System 2015-08-19 03:51:47 EDT
dnf-plugins-core-0.1.10-1.fc23, hawkey-0.6.0-1.fc23, dnf-1.1.0-2.fc23 has been pushed to the Fedora 23 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.