Bug 1249379 - dnf downgrade of a broken package may leave package uninstalled
Summary: dnf downgrade of a broken package may leave package uninstalled
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Honza Silhan
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-08-02 07:58 UTC by Ville Skyttä
Modified: 2015-08-19 07:51 UTC (History)
8 users (show)

Fixed In Version: dnf-plugins-core-0.1.10-1.fc23
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-08-15 02:13:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ville Skyttä 2015-08-02 07:58:59 UTC
# 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 08:00:10 UTC
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 15:26:31 UTC
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 15:11:07 UTC
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 15:24:57 UTC
Thanks Lubos.
Fixed in the upstream: https://github.com/rpm-software-management/dnf/commit/564f90e3941c402eb63b70c5ba9d89ace65d8135

Comment 5 Fedora Update System 2015-08-13 08:17:06 UTC
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 08:17:14 UTC
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 16:55:14 UTC
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-15 02:13:57 UTC
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 07:51:47 UTC
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.