Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1710346

Summary: Package gets removed on failed update via dnf
Product: Red Hat Enterprise Linux 8 Reporter: Panu Matilainen <pmatilai>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED ERRATA QA Contact: Jan Blazek <jblazek>
Severity: high Docs Contact:
Priority: high    
Version: 8.0CC: dmach, kwalker, mdomonko, tbowling, toneata
Target Milestone: rcKeywords: Triaged, ZStream
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.14.2-20.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1718236 (view as bug list) Environment:
Last Closed: 2019-11-05 22:22:37 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1718236    

Description Panu Matilainen 2019-05-15 11:33:23 UTC
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 1 Panu Matilainen 2019-05-15 11:34:56 UTC
Upstream fix is here: https://github.com/rpm-software-management/rpm/pull/706

Comment 17 errata-xmlrpc 2019-11-05 22:22:37 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-2019:3584