Bug 1708204

Summary: Do not create /etc/yum.repos.d on redhat-release installation
Product: Red Hat Enterprise Linux 8 Reporter: Marek Blaha <mblaha>
Component: redhat-releaseAssignee: Djordje Todorovic <dtodorov>
Status: CLOSED WONTFIX QA Contact: Release Test Team <release-test-team-automation>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: csnyder, dtodorov, pkotvan, tmlcoch
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-01 07:40:44 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: 1653484    

Description Marek Blaha 2019-05-09 11:15:19 UTC
Description of problem:
redhat-release package creates an empty /etc/yum.repos.d directory during installation.

This breaks DNF's detecting the location of the repository configuration files in case that the --installroot option was used.

E.g. in case of "dnf install --installroot=/the/installroot/ bash":
1. DNF try to use "guest" directory - it looks if path /the/installroot/etc/yum.repos.d exists. If so, it uses this directory as repository configuration path (which is an empty directory in case the redhat-release was installed previously)
2. In case this path does not exist, DNF will use configuration from "host" (/etc/yum.repos.d directory) instead.

That means after installing redhat-release into the install root user is not
able to install any other package because there are not any repositories configured.


Version-Release number of selected component (if applicable):
# rpm -q redhat-release
redhat-release-8.0-0.44.el8.x86_64

How reproducible:
100%

Steps to Reproduce:
# rm -rf /the/installroot

# dnf --releasever=el8 --installroot=/the/installroot install redhat-release
Installed:
  redhat-release-8.0-0.44.el8.x86_64

# ls -la /the/installroot/etc/yum.repos.d/
total 0
drwxr-xr-x. 2 root root   6 Mar  5 10:44 .
drwxr-xr-x. 7 root root 188 May  9 07:03 ..

# dnf --releasever=el8 --installroot=/the/installroot install bash
Error: There are no enabled repos.

# rmdir /the/installroot/etc/yum.repos.d

# dnf --releasever=el8 --installroot=/the/installroot install bash
Installed:
  bash-4.4.19-7.el8.x86_64

Actual results:
No enabled repos.

Expected results:
Repos from "host" system are available

Additional info:

Comment 1 Tomas Mlcoch 2019-05-10 12:18:08 UTC
Chris, I wonder if this change won't break subscription-manager?

Comment 2 Lisa S 2020-04-03 20:04:15 UTC
Chris, can you answer the question above?

Comment 6 Chris Snyder 2020-09-02 19:54:05 UTC
In subscription-manager's current form, users will still be able to register, attach / remove subscriptions and so on. However, subscription-manager does not create this directory if it does not exist resulting in no access to any content provided in the form of a repo that comes from an entitlement.

As soon as this directory is created (and rhsmcertd runs, or any subman command that reconciles entitlements) the correct redhat.repo file will be generated.

Could dnf be modified to handle the special case of an empty /installroot/etc/yum.repos.d/ directory?
It could treat an empty /installroot/etc/yum.repos.d directory as it does with a nonexistant /installroot/etc/yum.repos.d folder, rely on the host /etc/yum.repos.d directory.

Comment 10 RHEL Program Management 2021-02-01 07:40:44 UTC
After evaluating this issue, there are no plans to address it further or fix it in an upcoming release.  Therefore, it is being closed.  If plans change such that this issue will be fixed in an upcoming release, then the bug can be reopened.