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 2142934

Summary: DNF deletes local packages after installation
Product: Red Hat Enterprise Linux 8 Reporter: Renaud Métrich <rmetrich>
Component: dnfAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED DUPLICATE QA Contact: swm-qe
Severity: high Docs Contact:
Priority: high    
Version: 8.7CC: bwelterl, james.antill, jkolarik
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-16 07:17:59 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:

Description Renaud Métrich 2022-11-15 14:53:48 UTC
Description of problem:

When installing packages hosted locally (not in a repository), DNF deletes the packages after installation, unless "--setopt keepcache=true" is used.

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# yum update -y --downloadonly --downloaddir=localdir
# ls localdir/
systemd-239-68.el8.x86_64.rpm       systemd-pam-239-68.el8.x86_64.rpm
systemd-libs-239-68.el8.x86_64.rpm  systemd-udev-239-68.el8.x86_64.rpm

# yum update localdir/*.rpm
...
======================================================================================================================
 Package                      Architecture           Version                       Repository                    Size
======================================================================================================================
Upgrading:
 systemd                      x86_64                 239-68.el8                    @commandline                 3.6 M
 systemd-libs                 x86_64                 239-68.el8                    @commandline                 1.1 M
 systemd-pam                  x86_64                 239-68.el8                    @commandline                 491 k
 systemd-udev                 x86_64                 239-68.el8                    @commandline                 1.6 M

Transaction Summary
======================================================================================================================
Upgrade  4 Packages

Total size: 6.8 M
Is this ok [y/N]: y
...

# ls localdir/
--> empty
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Additionally, assuming "--setopt keepcache=true" was used, downgrading the packages (using the standard repository) deletes the local packages as well:

-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# ls localdir/
systemd-239-68.el8.x86_64.rpm       systemd-pam-239-68.el8.x86_64.rpm
systemd-libs-239-68.el8.x86_64.rpm  systemd-udev-239-68.el8.x86_64.rpm

# yum --setopt keepcache=true -y update localdir/*.rpm 
...

# ls localdir/
systemd-239-68.el8.x86_64.rpm       systemd-pam-239-68.el8.x86_64.rpm
systemd-libs-239-68.el8.x86_64.rpm  systemd-udev-239-68.el8.x86_64.rpm

# yum -y downgrade systemd
...

# ls localdir/
--> empty
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------


Version-Release number of selected component (if applicable):

dnf-4.7.0-11.el8.noarch

How reproducible:

Always, see above

Comment 1 Jan Kolarik 2022-11-16 07:17:59 UTC
This is an already resolved issue. DNF CLI documentation is going to be updated to better inform user about this behavior starting with dnf-4.7.0-13.el8. As an workaround the 'download' command could be used. For more information please refer to the original resolving ticket https://bugzilla.redhat.com/show_bug.cgi?id=2100811.

*** This bug has been marked as a duplicate of bug 2100811 ***

Comment 2 Renaud Métrich 2022-11-16 07:45:45 UTC
OK thank you.

Unfortunately the "download" feature cannot be considered as a workaround here, because it cannot be used to download only latest packages that need updating, which is customer's scenario.

I hence proposed him to execute this instead:

1. Collect what needs to be updated

 # PACKAGES=$(yum check-update -q | awk '{ print $1 }')

2. Download the packages

 # [ -n "$PACKAGES" ] && yum download $PACKAGES --destdir=localdir