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 1781420

Summary: microdnf --disablerepo=* fails
Product: Red Hat Enterprise Linux 8 Reporter: Derrick Ornelas <dornelas>
Component: microdnfAssignee: Jaroslav Rohel <jrohel>
Status: CLOSED ERRATA QA Contact: Radek Bíba <rbiba>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.1CC: ahogbin, amatej, dornelas, jrohel, lberton, rmahique, smccarty
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libdnf-0.39.1-3.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:55:25 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: 1186913    

Description Derrick Ornelas 2019-12-10 00:49:26 UTC
Description of problem:

Using '--disablerepos=*' with microdnf fails with the following error:

  error: (--disablerepo) repo * not found


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

microdnf-3.0.1-3.el8


How reproducible: 100%


Steps to Reproduce:
1.  Start ubi8 container

  podman run --rm -ti registry.access.redhat.com/ubi8-minimal bash


2.  Install a package from the ubi repos

  microdnf --disablerepo=* --enablerepo=ubi-8-baseos --enablerepo=ubi-8-appstream install tar


Actual results:

microdnf fails to install the package with the following error:

error: (--disablerepo) repo * not found


Expected results:

All repos are disabled except for the ones that were explicitly enabled


Additional info:

Full output from reproducer:

# podman run --rm -ti registry.access.redhat.com/ubi8-minimal bash

[root@119fc4dd37a5 /]# microdnf --disablerepo=* --enablerepo=ubi-8-baseos --enablerepo=ubi-8-appstream install tar

(process:10): libdnf-WARNING **: 00:16:56.608: Loading "/etc/dnf/dnf.conf": IniParser: Can't open file
error: (--disablerepo) repo * not found

[root@119fc4dd37a5 /]# microdnf --enablerepo=ubi-8-baseos --enablerepo=ubi-8-appstream install tar

(process:12): libdnf-WARNING **: 00:20:39.879: Loading "/etc/dnf/dnf.conf": IniParser: Can't open file
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                         Repository                                  Size
Installing:                                                                                                                                                     
 tar-2:1.30-4.el8.x86_64                                                                                        ubi-8-baseos                            858.4 kB
Transaction Summary:
 Installing:        1 packages
 Reinstalling:      0 packages
 Upgrading:         0 packages
 Removing:          0 packages
 Downgrading:       0 packages
Downloading packages...
Running transaction test...
Installing: tar;2:1.30-4.el8;x86_64;ubi-8-baseos
Complete.


This issue is important, because, in order for UBI container images to be distributable they must not contain any non-UBI content.  We ask users, Partners, ISVs, etc. to explicitly disable all RH product repos to avoid including this content, but this is not currently possible with microdnf v3.  Here's an example of installing postgresql which is not provided via UBI and should not be installable in a pure UBI environment:


# podman run --rm -ti registry.access.redhat.com/ubi8-minimal bash
[root@19f3bd254793 /]# rpm -q microdnf
microdnf-3.0.1-3.el8.x86_64

[root@19f3bd254793 /]# microdnf --enablerepo=ubi-8-baseos --enablerepo=ubi-8-appstream install postgresql-server

(process:11): libdnf-WARNING **: 00:30:59.097: Loading "/etc/dnf/dnf.conf": IniParser: Can't open file
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Package                                                                                                         Repository                                  Size
Installing:                                                                                                                                                     
 acl-2.2.53-1.el8.x86_64                                                                                        ubi-8-baseos                             83.0 kB
 cracklib-2.9.6-15.el8.x86_64                                                                                   ubi-8-baseos                             95.5 kB
 cracklib-dicts-2.9.6-15.el8.x86_64                                                                             ubi-8-baseos                              4.1 MB
 cryptsetup-libs-2.2.0-2.el8.x86_64                                                                             ubi-8-baseos                            432.1 kB
 dbus-1:1.12.8-9.el8.x86_64                                                                                     ubi-8-baseos                             41.4 kB
 dbus-common-1:1.12.8-9.el8.noarch                                                                              ubi-8-baseos                             46.2 kB
 dbus-daemon-1:1.12.8-9.el8.x86_64                                                                              ubi-8-baseos                            246.7 kB
 dbus-libs-1:1.12.8-9.el8.x86_64                                                                                ubi-8-baseos                            188.2 kB
 dbus-tools-1:1.12.8-9.el8.x86_64                                                                               ubi-8-baseos                             87.3 kB
 device-mapper-8:1.02.163-5.el8.x86_64                                                                          ubi-8-baseos                            380.0 kB
 device-mapper-libs-8:1.02.163-5.el8.x86_64                                                                     ubi-8-baseos                            412.8 kB
 diffutils-3.6-5.el8.x86_64                                                                                     ubi-8-baseos                            367.9 kB
 elfutils-default-yama-scope-0.176-5.el8.noarch                                                                 ubi-8-baseos                             48.1 kB
 elfutils-libs-0.176-5.el8.x86_64                                                                               ubi-8-baseos                            328.9 kB
 gzip-1.9-9.el8.x86_64                                                                                          ubi-8-baseos                            170.9 kB
 iptables-libs-1.8.2-16.el8.x86_64                                                                              ubi-8-baseos                            101.1 kB
 kmod-libs-25-13.el8.x86_64                                                                                     ubi-8-baseos                             70.7 kB
 libfdisk-2.32.1-17.el8.x86_64                                                                                  ubi-8-baseos                            255.0 kB
 libnsl2-1.2.0-2.20180605git4a062cf.el8.x86_64                                                                  ubi-8-baseos                             59.1 kB
 libpcap-14:1.9.0-3.el8.x86_64                                                                                  ubi-8-baseos                            164.1 kB
 libpq-10.5-1.el8.x86_64                                                                                        ubi-8-appstream                         192.7 kB
 libpwquality-1.4.0-9.el8.x86_64                                                                                ubi-8-baseos                            105.0 kB
 libseccomp-2.4.1-1.el8.x86_64                                                                                  ubi-8-baseos                             66.4 kB
 libsemanage-2.9-1.el8.x86_64                                                                                   ubi-8-baseos                            168.8 kB
 libtirpc-1.1.4-4.el8.x86_64                                                                                    ubi-8-baseos                            115.5 kB
 libutempter-1.1.6-14.el8.x86_64                                                                                ubi-8-baseos                             32.6 kB
 libxkbcommon-0.8.2-1.el8.x86_64                                                                                ubi-8-appstream                         118.7 kB
 pam-1.3.1-4.el8.x86_64                                                                                         ubi-8-baseos                            752.0 kB
 postgresql-10.6-1.module+el8+2469+5ecd5aae.x86_64                                                              rhel-8-for-x86_64-appstream-rpm           1.6 MB
 postgresql-server-10.6-1.module+el8+2469+5ecd5aae.x86_64                                                       rhel-8-for-x86_64-appstream-rpm           5.3 MB
 shadow-utils-2:4.6-8.el8.x86_64                                                                                ubi-8-baseos                              1.3 MB
 systemd-239-18.el8.x86_64                                                                                      ubi-8-baseos                              3.6 MB
 systemd-pam-239-18.el8.x86_64                                                                                  ubi-8-baseos                            235.1 kB
 util-linux-2.32.1-17.el8.x86_64                                                                                ubi-8-baseos                              2.6 MB
 xkeyboard-config-2.24-3.el8.noarch                                                                             ubi-8-appstream                         847.9 kB
Transaction Summary:
[...]
Complete.



With microdnf v2, all repos were disabled by default, and any repos you wanted to use had to be explicitly enabled.  Here's an example:

# podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash

bash-4.2# rpm -q microdnf
microdnf-2-8.el7.x86_64

bash-4.2# microdnf --enablerepo=ubi-7 install postgresql-server
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
error: No package matches 'postgresql-server'


bash-4.2# microdnf --enablerepo=rhel-7-server-rpms install postgresql-server
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Downloading metadata...
Transaction: 40 packages
[...]
postgresql-server-9.2.24-1.el7_5.x86_64 (rhel-7-server-rpms)
[...]
Installing: postgresql-server;9.2.24-1.el7_5;x86_64;rhel-7-server-rpms
[...]
Complete.

Comment 1 Jaroslav Rohel 2019-12-15 17:11:01 UTC
> Using '--disablerepo=*' with microdnf fails with the following error:

Yes. Microdnf does not support wildcards in the "--enablerepo" and "--disablerepo" arguments.

The libdnf library functions are used internally: 
- "dnf_context_repo_enable()"
- "dnf_context_repo_disable()"

So I prepared a patch with wildcards support for the libdnf library (into listed functions).

PR https://github.com/rpm-software-management/libdnf/pull/863

Comment 2 Jaroslav Rohel 2019-12-16 07:58:20 UTC
Note:
> With microdnf v2, all repos were disabled by default, and any repos you wanted to use had to be explicitly enabled.

I can't reproduce the statement. Are you sure that the "rhel-7-server-rpms" repository was not disabled in configuration file? (Maybe there is a change of default settings of the distributed repository.)

Example:
I tried 3 tests:
# podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash
bash-4.2# microdnf  install libpcap

# podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash
bash-4.2# microdnf --enablerepo=ubi-7 install libpcap

# podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash
bash-4.2# microdnf --enablerepo=ubi-7-server-optional-rpms install libpcap

The "libpcap" was allways installed until I disabled "ubi-7" repository (--disablerepo=ubi-7).

Comment 3 Derrick Ornelas 2019-12-16 19:26:20 UTC
(In reply to Jaroslav Rohel from comment #2)
> Note:
> > With microdnf v2, all repos were disabled by default, and any repos you wanted to use had to be explicitly enabled.
> 
> I can't reproduce the statement. Are you sure that the "rhel-7-server-rpms"
> repository was not disabled in configuration file? (Maybe there is a change
> of default settings of the distributed repository.)
> 
> Example:
> I tried 3 tests:
> # podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash
> bash-4.2# microdnf  install libpcap
> 
> # podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash
> bash-4.2# microdnf --enablerepo=ubi-7 install libpcap
> 
> # podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash
> bash-4.2# microdnf --enablerepo=ubi-7-server-optional-rpms install libpcap
> 
> The "libpcap" was allways installed until I disabled "ubi-7" repository
> (--disablerepo=ubi-7).

Sorry I wasn't more clear.  The "ubi-7" repo is statically defined in /etc/yum.repos.d/ubi.repo which is baked into all UBI7 images.  It will always be enabled, as will a few other repos. We always want these repos enabled so that users can easily get updates for the packages that are pre-installed in the image.  Here's the default repo list:

# podman run --rm -ti registry.access.redhat.com/ubi7-minimal bash

bash-4.2# awk '/^\[/{nr[NR]; nr[NR+3]; print '\n'}; NR in nr' /etc/yum.repos.d/ubi.repo

[ubi-7]
enabled = 1

[ubi-7-server-debug-rpms]
enabled = 0

[ubi-7-server-source-rpms]
enabled = 0

[ubi-7-server-optional-rpms]
enabled = 1

[ubi-7-server-optional-debug-rpms]
enabled = 0

[ubi-7-server-optional-source-rpms]
enabled = 0

[ubi-7-server-extras-rpms]
enabled = 1

[ubi-7-server-extras-debug-rpms]
enabled = 0

[ubi-7-server-extras-source-rpms]
enabled = 0

[ubi-7-rhah]
enabled = 1

[ubi-7-rhah-debug]
enabled = 0

[ubi-7-rhah-source]
enabled = 0

[ubi-server-rhscl-7-rpms]
enabled = 1

[ubi-server-rhscl-7-debug-rpms]
enabled = 0

[ubi-server-rhscl-7-source-rpms]
enabled = 0

[ubi-7-server-devtools-rpms]
enabled = 1

[ubi-7-server-devtools-debug-rpms]
enabled = 0

[ubi-7-server-devtools-source-rpms]
enabled = 0



When /etc/yum.repos.d/redhat.repo is dynamically created after running microdnf for the first time all of the Red Hat repos are defined as disabled:

bash-4.2# cat /etc/yum.repos.d/redhat.repo 
cat: /etc/yum.repos.d/redhat.repo: No such file or directory

bash-4.2# microdnf       
This is microdnf, which implements subset of `dnf'.
Usage:
  microdnf [OPTION?] COMMAND
[...]
error: No command specified


bash-4.2# grep "enabled=" /etc/yum.repos.d/redhat.repo | sort | uniq -c
    969 enabled=false

The large number of repos is caused by using a Red Hat Employee subscription for this test, but I don't think that has any other effect on this test.

Comment 4 Jaroslav Rohel 2019-12-16 20:29:18 UTC
I prepared CI tests. PR https://github.com/rpm-software-management/ci-dnf-stack/pull/734

Comment 12 errata-xmlrpc 2020-04-28 16:55:25 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/RHEA-2020:1855