Bug 1657150

Summary: dnf not using repos from the host system with --installroot
Product: Red Hat Enterprise Linux 8 Reporter: Karel Srot <ksrot>
Component: dnfAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: high    
Version: 8.0CC: dmach, james.antill, jmracek, ksrot, kwalker, msuchy
Target Milestone: rcKeywords: Regression, Triaged
Target Release: 8.0   
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: 2018-12-12 12:19:42 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 Karel Srot 2018-12-07 09:26:06 UTC
Description of problem:

This is a difference compared to RHEL-7 and compared to dnf-2.7 from Alpha.


# yum install systemd --installroot=/tmp/root --releasever=/
... installs systemd package into /tmp/root
# yum install aide --installroot=/tmp/root --releasever=/
Error: There are no enabled repos.

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

How reproducible:
always

Steps to Reproduce:
1. see above

Additional info:
According to the dnf man page:

config file and reposdir are searched inside the installroot first. If they are not present, they are taken from host system.

Comment 1 Jaroslav Mracek 2018-12-07 12:19:30 UTC
The problem was previously reported in https://bugzilla.redhat.com/show_bug.cgi?id=1582535. Please check discussion there and in PR https://github.com/rpm-software-management/dnf/pull/1191 where there are arguments that confirms that the current behavior of DNF is correct.

I also check a documentation and I found that work-around is well described and difference is also described in yum-dnf differences chapter. See:

- *config file* and :ref:`reposdir <reposdir-label>` are searched inside the installroot first. If
  they are not present, they are taken from host system.
  Note:  When a path is specified within command line argument
  (``--config=<config file>`` in case of *config file* and
  ``--setopt=reposdir=<reposdir>`` for *reposdir*) then this path is always
  related to the host with no exceptions.


Do you think that the bug report is still relevant?

Comment 2 Karel Srot 2018-12-07 14:22:02 UTC
Yes, it is still relevant because the dnf man page (and also upstream doc) are misleading in statement:
"config file and reposdir are searched inside the  installroot  first.
         If  they  are  not  present,  they are taken from host system."

This documentation should be updated at least with additional information explaining that the above applies only to the 1st command issued and once the $installroot/etc/yum.repos.d/ directory exist the host system repos are not used, along with a justification for that.

Comment 3 Jaroslav Mracek 2018-12-07 15:43:57 UTC
Please if you can provide a formulation that would satisfy you it would be great. Thanks a lot.

Comment 4 Karel Srot 2018-12-07 16:30:49 UTC
Well, I would need to know what is the current behaviour first. Does the statement above still apply for config files?

Comment 5 Jaroslav Mracek 2018-12-10 13:30:03 UTC
The man page for installroot option is according to dnf behavior. Therefore I believe that the bug is resolved. Please is there anything what has to be changed?