Bug 1710691

Summary: Package gets removed on failed update via dnf
Product: Red Hat Enterprise Linux 7 Reporter: Panu Matilainen <pmatilai>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: Luca Berton <lberton>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: lberton, mdomonko
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.11.3-43.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-31 20:01:53 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Panu Matilainen 2019-05-16 05:43:12 UTC
This bug was initially created as a copy of Bug #1710346

I am copying this bug because: 

AIUI yum doesn't exhibit this problem, but the bug exists in rpm 4.11 nevertheless and the dnf tech-preview (or something like that) in RHEL-7 extras is expected to be affected. Because dnf is not the default in RHEL-7, the priority is lower than in RHEL-8.

Description of problem:

When updating packages with dnf, if install of the newer package fails the package gets entirely removed as the cleanup stage runs despite the failure.

Version-Release number of selected component (if applicable):
All versions of rpm up to 4.14.2

How reproducible:
Always

Steps to Reproduce:
1. mount an iso image on /mnt
2. update/downgrade filesystem package

Actual results:
filesystem package gets removed completely

Expected results:
filesystem package stays in the original version

Additional info:
Here's a replay of it on Fedora, but equally applicable to RHEL and should be reproducable with just %pre scriptlet failure as well.

[root@sopuli ~]# rpm -q filesystem
filesystem-3.9-2.fc29.x86_64
[root@sopuli ~]# mount -o loop ~pmatilai/iso/Fedora-Server-dvd-x86_64-28-1.1.iso /mnt/
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@sopuli ~]# dnf -y -q update filesystem-3.10-1.fc30.x86_64.rpm 
Error unpacking rpm package filesystem-3.10-1.fc30.x86_64
Error: Transaction failed
[root@sopuli ~]# rpm -q filesystem
package filesystem is not installed
[root@sopuli ~]#

The reason for this is somewhat unexpected (but legitimate) API use by dnf, so it cannot be reproduced by rpm itself. The bug is certainly in rpm though.

Comment 8 errata-xmlrpc 2020-03-31 20:01:53 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1114

Comment 9 Fedora Update System 2020-05-30 01:45:17 UTC
FEDORA-EPEL-2020-3ef1e07e82 has been pushed to the Fedora EPEL 7 stable repository.
If problem still persists, please make note of it in this bug report.