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 2039261 - dnf --installroot ignores gpg keys in installroot path and requires them to be present in the default path
Summary: dnf --installroot ignores gpg keys in installroot path and requires them to b...
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: dnf
Version: 8.5
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Jaroslav Mracek
QA Contact: swm-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-01-11 11:40 UTC by Marcin Skarbek
Modified: 2023-05-03 13:39 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-16 15:04:45 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-107405 0 None None None 2022-01-11 11:44:37 UTC

Description Marcin Skarbek 2022-01-11 11:40:40 UTC
Description of problem:
DNF fails to acknowledge existence of the GPG keys inside `installroot` path and looks for them in default path (/etc/pki/rpm-gpg) on the host. This forces copying key files onto host if we want to maintain `gpgcheck` enabled. 


Version-Release number of selected component (if applicable):
dnf-4.7.0-4.el8.noarch


How reproducible:
Every time.


Steps to Reproduce:
'''bash
# TEMP_ROOT=$(mktemp -d)
# dnf -y install --installroot=${TEMP_ROOT} --releasever=8 https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
(...)
Installed:
  pgdg-redhat-repo-42.0-23.noarch                       redhat-release-8.5-0.8.el8.x86_64                       redhat-release-eula-8.5-0.8.el8.x86_64

Complete!
# ls ${TEMP_ROOT}/etc/pki/rpm-gpg
ISV-Container-signing-key  RPM-GPG-KEY-PGDG  RPM-GPG-KEY-redhat-beta  RPM-GPG-KEY-redhat-release
# dnf install --installroot=${TEMP_ROOT} --releasever=8 postgresql14-server postgresql14-contrib
'''

Actual results:
'''bash
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64                                                                                             385  B/s | 195  B     00:00    
PostgreSQL common RPMs for RHEL/CentOS 8 - x86_64                                                                                             0.0  B/s |   0  B     00:00    
Errors during downloading metadata for repository 'pgdg-common':
  - Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG]
Error: Failed to retrieve GPG key for repo 'pgdg-common': Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG]
'''

Expected results:
DNF correctly detects GPG keys in `installroot` path and installs packages without error.


Additional info:
Currently, I need to copy GPG keys from ${TEMP_ROOT}/etc/pki/rpm-gpg to /etc/pki/rpm-gpg for DNF to work or use `--nogpgcheck`.

Basically, DNF needs to extend `file://` path of GPG key from repo file by prefixing it with `installroot` path when `installroot` is present.

Comment 1 Jaroslav Mracek 2022-02-16 15:04:45 UTC
I am really sorry, I understand your issue but the change will brake other user cases. The issue can be resolved not only by copy of files but also by manual import of required keys into rpm in installroot. Then dnf will not try to import keys from the location. Additionally you can modify the path to gpg keys directly from command line using --setopt.

dnf install --installroot=${TEMP_ROOT} --releasever=8 postgresql14-server postgresql14-contrib --setopt=pgdg-common.gpgkey=${TEMP_ROOT}/etc/pki/rpm-gpg/RPM-GPG-KEY-PGDG

I am really sorry but we cannot do much more.

Comment 2 Marcin Skarbek 2023-05-03 13:39:29 UTC
Can this be resolved properly in RHEL 10?


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