Bug 1071854 - dnf reinstall does not work as expected
dnf reinstall does not work as expected
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Honza Silhan
Fedora Extras Quality Assurance
:
: 1092830 (view as bug list)
Depends On: 966715
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-03 05:23 EST by Hans de Goede
Modified: 2014-09-23 00:40 EDT (History)
8 users (show)

See Also:
Fixed In Version: dnf-0.6.1-1.fc21
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-09-23 00:40:13 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)
/tmp/dnf-reinstall-0.patch (1.76 KB, patch)
2014-03-04 07:16 EST, Panu Matilainen
no flags Details | Diff

  None (edit)
Description Hans de Goede 2014-03-03 05:23:24 EST
Hi,

After locally building and installing some packages before submitting them to the buildsys I wanted to reinstall them from the repo once they hit the repo.

So I did:

[hans@shalem ~]$ sudo dnf reinstall gstreamer1-plugins-ugly gstreamer1-plugins-bad-freeworld gstreamer1-libav audacious-plugins-freeworld* mpg123* libmpg123*
Resolving dependencies
--> Starting dependency resolution
--> Finished dependency resolution
Dependencies resolved.
Nothing to do.

Which is not what I expected, yum did do what I wanted:

[hans@shalem ~]$ sudo yum reinstall gstreamer1-plugins-ugly gstreamer1-plugins-bad-freeworld gstreamer1-libav audacious-plugins-freeworld* mpg123* libmpg123*
<snip>
Reinstalling:
 audacious-plugins-freeworld  x86_64 3.4.3-1.fc21  rpmfusion-free-rawhide 7.5 k
 audacious-plugins-freeworld-aac
                              x86_64 3.4.3-1.fc21  rpmfusion-free-rawhide  32 k
 audacious-plugins-freeworld-ffaudio
                              x86_64 3.4.3-1.fc21  rpmfusion-free-rawhide  18 k
 audacious-plugins-freeworld-mms
                              x86_64 3.4.3-1.fc21  rpmfusion-free-rawhide  14 k
 audacious-plugins-freeworld-mp3
                              x86_64 3.4.3-1.fc21  rpmfusion-free-rawhide  16 k
 gstreamer1-libav             x86_64 1.2.3-1.fc21  rpmfusion-free-rawhide 2.8 M
 gstreamer1-plugins-bad-freeworld
                              x86_64 1.2.3-1.fc21  rpmfusion-free-rawhide 157 k
 gstreamer1-plugins-ugly      x86_64 1.2.3-1.fc21  rpmfusion-free-rawhide 245 k
 libmpg123                    x86_64 1.18.1-1.fc21 rpmfusion-free-rawhide 165 k
 libmpg123-devel              x86_64 1.18.1-1.fc21 rpmfusion-free-rawhide 262 k
 mpg123                       x86_64 1.18.1-1.fc21 rpmfusion-free-rawhide 102 k
 mpg123-plugins-pulseaudio    x86_64 1.18.1-1.fc21 rpmfusion-free-rawhide  11 k

Transaction Summary
===========================================================
Reinstall  12 Packages

Regards,

Hans
Comment 1 Parag Nemade 2014-03-03 23:56:49 EST
To add here my observations,
[parag@f20 ~]$ sudo dnf reinstall yumex
Resolving dependencies
--> Starting dependency resolution
---> Package yumex.noarch 3.0.14-1.fc20 will be reinstalled
--> Finished dependency resolution
Dependencies resolved.

================================================================================
 Package        Arch            Version                  Repository        Size
================================================================================
Reinstalling:
 yumex          noarch          3.0.14-1.fc20            updates          431 k

Transaction Summary
================================================================================

Total download size: 431 k
Is this ok [y/N]: y
Downloading Packages:
yumex-3.0.14-1.fc20.noarch.rpm                  136 kB/s | 431 kB     00:03    
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Reinstalling: yumex-3.0.14-1.fc20.noarch                                  1/2 
  Verifying   : yumex-3.0.14-1.fc20.noarch                                  1/2 
  Verifying   : yumex-3.0.14-1.fc20.noarch                                  2/2 
Complete!
[parag@f20 ~]$ sudo dnf reinstall iok
Resolving dependencies
--> Starting dependency resolution
---> Package iok.x86_64 2.1.3-4.fc20 will be reinstalled
--> Finished dependency resolution
Dependencies resolved.

================================================================================
 Package       Arch             Version                  Repository        Size
================================================================================
Reinstalling:
 iok           x86_64           2.1.3-4.fc20             fedora           114 k

Transaction Summary
================================================================================

Total download size: 114 k
Is this ok [y/N]: y
Downloading Packages:
iok-2.1.3-4.fc20.x86_64.rpm                     307 kB/s | 114 kB     00:00    
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Reinstalling: iok-2.1.3-4.fc20.x86_64                                     1/2 
error: iok-2.1.3-4.fc20.x86_64: erase failed
  Verifying   : iok-2.1.3-4.fc20.x86_64                                     1/2 
  Verifying   : iok-2.1.3-4.fc20.x86_64                                     2/2 
Complete!
[parag@f20 ~]$ 


I am not sure why iok package failed to erase here?
Comment 2 Panu Matilainen 2014-03-04 02:39:41 EST
The erase failure is because of the way dnf tries to do reinstall, which is not supported by rpm:

            elif tsi.op_type == REINSTALL:
                ts.addErase(tsi.erased.idx)
                hdr = tsi.installed.header
                ts.addInstall(hdr, tsi, 'i')
                self.logger.debug("populate_rpm_ts: reinstall: %s" %
                                  tsi.erased)

dnf adds an erasure element, which would technically be the right way to perform a reinstall, but the installing with rpm.RPMPROB_FILTER_REPLACEPKG causes the header scheduled for removal to move, so its erasure fails. And without rpm.RPMPROB_FILTER_REPLACEPKG its not possible to do the install at all.

What's needed is a proper reinstall method in rpm (see bug 966715), until then dnf should just drop the addErase() part which is not going to work.
Comment 3 Panu Matilainen 2014-03-04 07:16:40 EST
Created attachment 870380 [details]
/tmp/dnf-reinstall-0.patch

Proof-of-concept patch to use rpm's reinstall method.

Note that this will NOT work with existing rpm releases, addReinstall() only exists in rpm git master at the moment. So you'd need to check for the existence of that method in rpm.ts (but the wrapper might get in the way), and fall back to what yum does if its not there (ie just add the install element, no erase element, and enable at least rpm.RPMPROB_FILTER_REPLACEPKG)

The problem filter handling in dnf is ... problematic, there should never be any problem filters enabled by default, but that's another story, another related bug as well...
Comment 4 Adam Williamson 2014-03-07 17:36:39 EST
I tried a 'dnf reinstall gjs gjs-debuginfo' this morning, and got "Nothing to do." 'yum reinstall gjs gjs-debuginfo' did the expected (reinstalled it).
Comment 5 Ivana Varekova 2014-06-26 05:44:09 EDT
*** Bug 1092830 has been marked as a duplicate of this bug. ***
Comment 6 Ales Kozumplik 2014-06-26 06:47:51 EDT
Radek, I'm reassigning this to Ivana who already has some knowledge about the problem.

Panu, is that correct that that addReinstall() won't be available in F20? In that case, Ivana, please fix this in the way it works in F20 Yum so we don't have a breakage like this.
Comment 7 Panu Matilainen 2014-06-26 06:55:22 EDT
I've no plans wrt backporting addReinstall() and everything it needs to rpm 4.11.x - it might happen or then (more likely) not. So for all currently released rpm versions, you need a different fix.
Comment 8 Honza Silhan 2014-08-28 09:10:41 EDT
Fixed in the upstream with Panu's help (thanks). Upstream DNF is dependent on rpm >= 4.12.0
Comment 9 Fedora Update System 2014-09-04 11:49:29 EDT
dnf-0.6.1-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/dnf-0.6.1-1.fc21
Comment 10 Fedora Update System 2014-09-05 20:59:59 EDT
Package dnf-0.6.1-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing dnf-0.6.1-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-10199/dnf-0.6.1-1.fc21
then log in and leave karma (feedback).
Comment 11 Fedora Update System 2014-09-23 00:40:13 EDT
dnf-0.6.1-1.fc21 has been pushed to the Fedora 21 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.