Bug 1275025 - dnf remove of duplicate package fails when the package is protected
dnf remove of duplicate package fails when the package is protected
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: dnf (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-24 23:19 EDT by Zbigniew Jędrzejewski-Szmek
Modified: 2017-03-04 10:15 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-10-26 09:11:33 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 Zbigniew Jędrzejewski-Szmek 2015-10-24 23:19:50 EDT
Description of problem:
I have two systemd packages installed (interrupted system upgrade, don't ask):
$ rpm -q systemd
systemd-219-25.fc22.x86_64
systemd-222-8.fc23.x86_64

I would like to remove the old one:
$ sudo dnf remove systemd-219-25.fc22.x86_64
Dependencies resolved.
Error: The operation would result in removing the following protected packages: systemd.

Version-Release number of selected component (if applicable):
$ rpm -q dnf
dnf-1.1.3-1.fc23.noarch

Actual results:
dnf refuses to remove any protected duplicated package (e.g. the same problem happens with dnf itself.)

Expected results:
dnf uninstalls protected packages if they are installed more than once.
Maybe it should allow uninstalling only the old ones, not sure.

This bug is similar to 1229946, but autoremove is not involved here, so I'm opening a new bug.
Comment 1 Honza Silhan 2015-10-26 09:11:33 EDT
At first look it is a valid bug report but we don't know how to figure out and protect the right version of protected package in case of duplicates. When you have corrupted system you as a user should repair it manually by rpm. DNF couldn't guess which of the packages is improperly installed. I am sorry but I am closing this. You should use `rpm -e ...`
Comment 2 Zbigniew Jędrzejewski-Szmek 2015-10-26 09:48:18 EDT
I always interpreted the protection to mean that dnf will keep at least one version of the package around. Why not allow the removal of the older version?
Comment 3 Brian J. Murrell 2017-03-04 10:01:54 EST
Good question.  I wonder why no answer to it.
Comment 4 Brian J. Murrell 2017-03-04 10:15:57 EST
In fact, this is not even a case of DNF having to try to figure out which one to remove.  The suggested DNF operation to remove duplicated packages:

dnf remove $(dnf  repoquery  --duplicated  --latest-limit -1 -q)

Actually figures out which one to remove.  DNF just refuses to remove the duplicated "protected" package.

Note You need to log in before you can comment on or make changes to this bug.