Red Hat Bugzilla – Bug 1275025
dnf remove of duplicate package fails when the package is protected
Last modified: 2017-03-04 10:15:57 EST
Description of problem:
I have two systemd packages installed (interrupted system upgrade, don't ask):
$ rpm -q systemd
I would like to remove the old one:
$ sudo dnf remove systemd-219-25.fc22.x86_64
Error: The operation would result in removing the following protected packages: systemd.
Version-Release number of selected component (if applicable):
$ rpm -q dnf
dnf refuses to remove any protected duplicated package (e.g. the same problem happens with dnf itself.)
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.
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 ...`
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?
Good question. I wonder why no answer to it.
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.