Bug 1713626

Summary: New configuration "disable_system_repos=1" in /etc/dnf/plugins/subscription-manager.conf is not working as expected
Product: Red Hat Enterprise Linux 8 Reporter: Rehana <redakkan>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: medium    
Version: 8.1CC: cdonnell, csnyder, jhnidek
Target Milestone: rcKeywords: Triaged
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: 2020-11-04 01:38:37 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 Rehana 2019-05-24 09:47:05 UTC
Description of problem:
The new attribute disable_system_repos=1" (PR  :https://github.com/candlepin/subscription-manager/pull/1961/commits/dd275467409ae33c76792a6224e0646d3163f9a4 ) is not working as expected 

Version-Release number of selected component (if applicable):
subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.3.17-1
subscription management rules: 5.35
subscription-manager: 1.25.6-1.el8

dnf-4.0.9.2-5.el8.noarch

How reproducible:
always

Steps to Reproduce:
1.Register and subscribe system, make sure the system has additional repos outside of redhat.repo
2.set disable_system_repos=1 in  /etc/dnf/plugins/subscription-manager.conf --Issue 1
3.dnf clean all ;
# dnf repolist -d3
Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, needs-restarting, playground, product-id, repoclosure, repodiff, repograph, repomanage, reposync, subscription-manager, uploadprofile
Updating Subscription Management repositories.
DNF version: 4.0.9
cachedir: /var/cache/dnf
Last metadata expiration check: 0:43:22 ago on Friday 24 May 2019 04:43:46 AM EDT.
repo id                                                                                   repo name                                                                                                          status
beaker-AppStream                                                                          beaker-AppStream                                                                                                   4,701
beaker-AppStream-debuginfo                                                                beaker-AppStream-debuginfo                                                                                         3,644
beaker-BaseOS                                                                             beaker-BaseOS                                                                                                      1,664
beaker-BaseOS-debuginfo                                                                   beaker-BaseOS-debuginfo                                                                                            2,123
rhel-8-for-x86_64-appstream-beta-rpms                                                     Red Hat Enterprise Linux 8 for x86_64 - AppStream Beta (RPMs)                                                      4,695
rhel-8-for-x86_64-baseos-beta-rpms                                                        Red Hat Enterprise Linux 8 for x86_64 - BaseOS Beta (RPMs)                                                         1,658
^^NOTICE ALL BEAKER REPOS ARE STILL ENABLED ---Issue 2

Actual results:
Issue 1 : notice the message 
"# Setting disable_system_repos to 1, disables all system repositories
# (= repositories which are not mangaged by subscription-manager will NOT be used)
^^^^ it should be  (= repositories which are managed by subscription-manager will NOT be used)

Issue 2: when "disable_system_repos to 1" all beaker repos remained enabled , instead of disabled"

Expected results:
1) Message should be "(= repositories which are managed by subscription-manager will NOT be used)"

2) when "disable_system_repos to 1" all repos that are not managed by susbscription-manager should be disabled 

Additional info:

Comment 4 Craig Donnelly 2020-07-16 13:18:33 UTC
Verifying against RHEL 8.3 -> subscription-manager-1.27.8-1.el8.x86_64:

[root@dhcp-8-30-168 yum.repos.d]# rpm -q subscription-manager
subscription-manager-1.27.8-1.el8.x86_64

[root@dhcp-8-30-168 yum.repos.d]# ll
total 20
-rw-r--r--. 1 root root  192 Jul  1 15:13 8-3.repo
-rw-r--r--. 1 root root 2913 Jul 16 08:58 redhat.repo
-rw-r--r--. 1 root root  262 Jul  6 15:36 subscription-manager-1.27.8-1.el8.repo
-rw-r--r--. 1 root root  262 Jul  6 15:32 subscription-manager-1.27.9-1.el8.repo
-rw-r--r--. 1 root root  327 Jul  6 15:37 subscription-manager-1.27.9-1.git.4.aeb56fc.el8-scratch.repo

[root@dhcp-8-30-168 yum.repos.d]# yum repolist
Updating Subscription Management repositories.
repo id                                          repo name
8-3-repos-stuff                                  8-3-repo
brew-task-repo-subscription-manager-1.27.8-1.el8 Repo for Brew build of subscription-manager-1.27.8-1.el8
brew-task-repo-subscription-manager-1.27.9-1.el8 Repo for Brew build of subscription-manager-1.27.9-1.el8
rhel-8-for-x86_64-appstream-rpms                 Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms                    Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)

>> Set to disable
[root@dhcp-8-30-168 yum.repos.d]# vim /etc/dnf/plugins/subscription-manager.conf

[root@dhcp-8-30-168 yum.repos.d]# cat /etc/dnf/plugins/subscription-manager.conf
[main]
enabled=1

# When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
# every time subscription-manager plugin is triggered by dnf or yum
disable_system_repos=1

[root@dhcp-8-30-168 yum.repos.d]# yum repolist
Updating Subscription Management repositories.
subscription-manager plugin disabled 3 system repositories with respect of configuration in /etc/dnf/plugins/subscription-manager.conf
repo id                          repo name
rhel-8-for-x86_64-appstream-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms    Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)

>> Note works, and repos are not enabled.

[root@dhcp-8-30-168 yum.repos.d]# yum install httpd
Updating Subscription Management repositories.
subscription-manager plugin disabled 3 system repositories with respect of configuration in /etc/dnf/plugins/subscription-manager.conf
Red Hat Enterprise Linux 8 for x86_64 - AppStre 5.7 kB/s | 2.8 kB     00:00    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS  4.8 kB/s | 2.4 kB     00:00    
Dependencies resolved.
================================================================================
 Package            Arch   Version       Repository                        Size
================================================================================
Installing:
 httpd              x86_64 2.4.37-21.module+el8.2.0+5008+cca404a3
                                         rhel-8-for-x86_64-appstream-rpms 1.4 M
Installing dependencies:
 apr                x86_64 1.6.3-9.el8   rhel-8-for-x86_64-appstream-rpms 125 k
 apr-util           x86_64 1.6.1-6.el8   rhel-8-for-x86_64-appstream-rpms 105 k
 httpd-filesystem   noarch 2.4.37-21.module+el8.2.0+5008+cca404a3
                                         rhel-8-for-x86_64-appstream-rpms  36 k
 httpd-tools        x86_64 2.4.37-21.module+el8.2.0+5008+cca404a3
                                         rhel-8-for-x86_64-appstream-rpms 103 k
 mod_http2          x86_64 1.11.3-3.module+el8.2.0+4377+dc421495
                                         rhel-8-for-x86_64-appstream-rpms 158 k
 redhat-logos-httpd noarch 81.1-1.el8    rhel-8-for-x86_64-baseos-rpms     26 k
Installing weak dependencies:
 apr-util-bdb       x86_64 1.6.1-6.el8   rhel-8-for-x86_64-appstream-rpms  25 k
 apr-util-openssl   x86_64 1.6.1-6.el8   rhel-8-for-x86_64-appstream-rpms  27 k
Enabling module streams:
 httpd                     2.4                                                 

Transaction Summary
================================================================================
Install  9 Packages

Total download size: 2.0 M
Installed size: 5.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/9): apr-util-openssl-1.6.1-6.el8.x86_64.rpm   30 kB/s |  27 kB     00:00    
(2/9): apr-1.6.3-9.el8.x86_64.rpm               121 kB/s | 125 kB     00:01    
(3/9): apr-util-bdb-1.6.1-6.el8.x86_64.rpm       19 kB/s |  25 kB     00:01    
(4/9): apr-util-1.6.1-6.el8.x86_64.rpm          196 kB/s | 105 kB     00:00    
(5/9): httpd-filesystem-2.4.37-21.module+el8.2.  84 kB/s |  36 kB     00:00    
(6/9): httpd-tools-2.4.37-21.module+el8.2.0+500 207 kB/s | 103 kB     00:00    
(7/9): mod_http2-1.11.3-3.module+el8.2.0+4377+d 250 kB/s | 158 kB     00:00    
(8/9): redhat-logos-httpd-81.1-1.el8.noarch.rpm  65 kB/s |  26 kB     00:00    
(9/9): httpd-2.4.37-21.module+el8.2.0+5008+cca4 1.1 MB/s | 1.4 MB     00:01    
--------------------------------------------------------------------------------
Total                                           754 kB/s | 2.0 MB     00:02     
warning: /var/cache/dnf/rhel-8-for-x86_64-appstream-rpms-e3841b39b024e5e5/packages/apr-util-bdb-1.6.1-6.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Red Hat Enterprise Linux 8 for x86_64 - AppStre 4.9 MB/s | 5.0 kB     00:00    
Importing GPG key 0xFD431D51:
 Userid     : "Red Hat, Inc. (release key 2) <security>"
 Fingerprint: 567E 347A D004 4ADE 55BA 8A5F 199E 2F91 FD43 1D51
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Importing GPG key 0xD4082792:
 Userid     : "Red Hat, Inc. (auxiliary key) <security>"
 Fingerprint: 6A6A A7C9 7C88 90AE C6AE BFE2 F76F 66C3 D408 2792
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
Is this ok [y/N]: y
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                        1/1 
  Installing       : apr-1.6.3-9.el8.x86_64                                 1/9 
  Running scriptlet: apr-1.6.3-9.el8.x86_64                                 1/9 
  Installing       : apr-util-openssl-1.6.1-6.el8.x86_64                    2/9 
  Installing       : apr-util-1.6.1-6.el8.x86_64                            3/9 
  Running scriptlet: apr-util-1.6.1-6.el8.x86_64                            3/9 
  Installing       : apr-util-bdb-1.6.1-6.el8.x86_64                        4/9 
  Installing       : httpd-tools-2.4.37-21.module+el8.2.0+5008+cca404a3.x   5/9 
  Installing       : redhat-logos-httpd-81.1-1.el8.noarch                   6/9 
  Running scriptlet: httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca40   7/9 
  Installing       : httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca40   7/9 
  Installing       : mod_http2-1.11.3-3.module+el8.2.0+4377+dc421495.x86_   8/9 
  Installing       : httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64    9/9 
  Running scriptlet: httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64    9/9 
  Verifying        : apr-util-bdb-1.6.1-6.el8.x86_64                        1/9 
  Verifying        : apr-util-openssl-1.6.1-6.el8.x86_64                    2/9 
  Verifying        : apr-1.6.3-9.el8.x86_64                                 3/9 
  Verifying        : apr-util-1.6.1-6.el8.x86_64                            4/9 
  Verifying        : httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca40   5/9 
  Verifying        : mod_http2-1.11.3-3.module+el8.2.0+4377+dc421495.x86_   6/9 
  Verifying        : httpd-tools-2.4.37-21.module+el8.2.0+5008+cca404a3.x   7/9 
  Verifying        : httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64    8/9 
  Verifying        : redhat-logos-httpd-81.1-1.el8.noarch                   9/9 
Installed products updated.

Installed:
  apr-1.6.3-9.el8.x86_64                                             apr-util-1.6.1-6.el8.x86_64                                            
  apr-util-bdb-1.6.1-6.el8.x86_64                                    apr-util-openssl-1.6.1-6.el8.x86_64                                    
  httpd-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64                httpd-filesystem-2.4.37-21.module+el8.2.0+5008+cca404a3.noarch         
  httpd-tools-2.4.37-21.module+el8.2.0+5008+cca404a3.x86_64          mod_http2-1.11.3-3.module+el8.2.0+4377+dc421495.x86_64                 
  redhat-logos-httpd-81.1-1.el8.noarch                              

Complete!

>> Normal use works, other repos stay disabled.

>> Reconfiguring disable_system_repos=0 again:

[root@dhcp-8-30-168 yum.repos.d]# vim /etc/dnf/plugins/subscription-manager.conf 
[root@dhcp-8-30-168 yum.repos.d]# grep disable_system /etc/dnf/plugins/subscription-manager.conf
disable_system_repos=0
[root@dhcp-8-30-168 yum.repos.d]# yum repolist
Updating Subscription Management repositories.
repo id                                                            repo name
8-3-repos-stuff                                                    8-3-repo
brew-task-repo-subscription-manager-1.27.8-1.el8                   Repo for Brew build of subscription-manager-1.27.8-1.el8
brew-task-repo-subscription-manager-1.27.9-1.el8                   Repo for Brew build of subscription-manager-1.27.9-1.el8
rhel-8-for-x86_64-appstream-rpms                                   Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms                                      Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)

VERIFIED.

Comment 5 Craig Donnelly 2020-07-16 13:22:24 UTC
Also note new message describing the configuration:

# When following option is set to 1, then all repositories defined outside redhat.repo will be disabled
# every time subscription-manager plugin is triggered by dnf or yum

Comment 8 errata-xmlrpc 2020-11-04 01:38:37 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 (subscription-manager bug fix and enhancement update), 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/RHBA-2020:4460