Bug 1661219

Summary: installed product are removed after disabling a repository and installing any package
Product: Red Hat Enterprise Linux 8 Reporter: Karel Srot <ksrot>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: high    
Version: 8.0CC: cdonnell, csnyder, jhnidek, jsefler, khowell, nmoumoul, wchadwic
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: 2019-06-14 00:50:34 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-20 13:13:11 UTC
Description of problem:

when disabling a repo and installing a package the products matching disabled repos are not listed anymore despite the content is still present.

libdnf-0.22.4-1.el8.x86_64
dnf-4.0.9.1-1.el8.noarch
subscription-manager-1.23.8-11.el8.x86_64
librhsm-0.0.3-2.el8.x86_64


# dnf repolist
Updating Subscription Management repositories.
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:30 ago on Thu 20 Dec 2018 08:06:45 AM EST.
repo id                                     repo name                                                   status
rhel-8-for-x86_64-appstream-htb-rpms        Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs 6,185
rhel-8-for-x86_64-baseos-htb-rpms           Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)   2,688
rhel-8-for-x86_64-highavailability-htb-rpms Red Hat Enterprise Linux 8 for x86_64 - High Availability H    74
rhel-8-for-x86_64-resilientstorage-htb-rpms Red Hat Enterprise Linux 8 for x86_64 - Resilient Storage H    77
# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

# dnf -y install libknet1 
Updating Subscription Management repositories.
Updating Subscription Management repositories.
Last metadata expiration check: 0:01:06 ago on Thu 20 Dec 2018 08:06:45 AM EST.
Dependencies resolved.
==============================================================================================================
 Package          Arch           Version            Repository                                           Size
==============================================================================================================
Installing:
 libknet1         x86_64         1.4-2.el8          rhel-8-for-x86_64-highavailability-htb-rpms          69 k

Transaction Summary
==============================================================================================================
Install  1 Package

Total download size: 69 k
Installed size: 161 k
Downloading Packages:
libknet1-1.4-2.el8.x86_64.rpm                                                  44 kB/s |  69 kB     00:01    
--------------------------------------------------------------------------------------------------------------
Total                                                                          44 kB/s |  69 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                      1/1 
  Installing       : libknet1-1.4-2.el8.x86_64                                                            1/1 
  Running scriptlet: libknet1-1.4-2.el8.x86_64                                                            1/1 
  Verifying        : libknet1-1.4-2.el8.x86_64                                                            1/1 
Installed products updated.

Installed:
  libknet1-1.4-2.el8.x86_64                                                                                   

Complete!
# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

Product Name:   Red Hat Enterprise Linux High Availability High Touch Beta
Product ID:     236
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

Product Name:   Red Hat Enterprise Linux Resilient Storage High Touch Beta
Product ID:     238
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

# subscription-manager repos --disable rhel-8-for-x86_64-highavailability-htb-rpms --disable rhel-8-for-x86_64-resilientstorage-htb-rpms
Repository 'rhel-8-for-x86_64-highavailability-htb-rpms' is disabled for this system.
Repository 'rhel-8-for-x86_64-resilientstorage-htb-rpms' is disabled for this system.
# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

Product Name:   Red Hat Enterprise Linux High Availability High Touch Beta
Product ID:     236
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

Product Name:   Red Hat Enterprise Linux Resilient Storage High Touch Beta
Product ID:     238
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

# dnf -y install aide
Updating Subscription Management repositories.
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RPMs)                  3.2 kB/s | 4.1 kB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs)                     3.2 kB/s | 4.1 kB     00:01    
Dependencies resolved.
==============================================================================================================
 Package        Arch             Version                 Repository                                      Size
==============================================================================================================
Installing:
 aide           x86_64           0.16-8.el8              rhel-8-for-x86_64-appstream-htb-rpms           155 k

Transaction Summary
==============================================================================================================
Install  1 Package

Total download size: 155 k
Installed size: 374 k
Downloading Packages:
aide-0.16-8.el8.x86_64.rpm                                                    114 kB/s | 155 kB     00:01    
--------------------------------------------------------------------------------------------------------------
Total                                                                         114 kB/s | 155 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                      1/1 
  Installing       : aide-0.16-8.el8.x86_64                                                               1/1 
  Running scriptlet: aide-0.16-8.el8.x86_64                                                               1/1 
  Verifying        : aide-0.16-8.el8.x86_64                                                               1/1 
Installed products updated.

Installed:
  aide-0.16-8.el8.x86_64                                                                                      

Complete!
# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         04/24/2013
Ends:           12/31/2021

After enabling those repos and installing another package (from AppStream repo) Products are listed again.

Comment 2 Whitney Chadwick 2019-01-03 17:36:59 UTC
Set blocker+ per the RHEL 8 blocker/exception meeting

Comment 4 John Sefler 2019-01-21 22:58:08 UTC
Verifying Version...
[root@kvm-02-guest16 ~]# rpm -qa | grep dnf
python3-dnf-4.0.9.2-1.el8.noarch
dnf-data-4.0.9.2-1.el8.noarch
libdnf-0.22.5-1.el8.x86_64
dnf-4.0.9.2-1.el8.noarch
dnf-plugin-subscription-manager-1.23.8-14.el8.x86_64
python3-libdnf-0.22.5-1.el8.x86_64
python3-dnf-plugins-core-4.0.2.2-3.el8.noarch
dnf-plugins-core-4.0.2.2-3.el8.noarch
[root@kvm-02-guest16 ~]# rpm -q dnf-plugin-subscription-manager --changelog | grep 1661219
- 1661219: Do not delete product certs for disabled repos



[root@kvm-02-guest16 ~]# subscription-manager register --username=stage_auto_testuser --serverurl=subscription.rhsm.stage.redhat.com --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: 9a1e7911-6e1c-4692-8fb8-9b68d83192bf
The registered system name is: kvm-02-guest16.rhts.eng.brq.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Subscribed

[root@kvm-02-guest16 ~]# subscription-manager repos --enable=rhel-8-for-x86_64-highavailability-htb-rpms --enable=rhel-8-for-x86_64-resilientstorage-htb-rpms
Repository 'rhel-8-for-x86_64-highavailability-htb-rpms' is enabled for this system.
Repository 'rhel-8-for-x86_64-resilientstorage-htb-rpms' is enabled for this system.

[root@kvm-02-guest16 ~]# dnf repolist --quiet
repo id                                     repo name                               status
rhel-8-for-x86_64-appstream-htb-rpms        Red Hat Enterprise Linux 8 for x86_64 - 7,295
rhel-8-for-x86_64-baseos-htb-rpms           Red Hat Enterprise Linux 8 for x86_64 - 3,329
rhel-8-for-x86_64-highavailability-htb-rpms Red Hat Enterprise Linux 8 for x86_64 -   107
rhel-8-for-x86_64-resilientstorage-htb-rpms Red Hat Enterprise Linux 8 for x86_64 -   110

[root@kvm-02-guest16 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

[root@kvm-02-guest16 ~]# dnf install libknet1 --assumeyes --nogpgcheck
Updating Subscription Management repositories.
Last metadata expiration check: 0:01:31 ago on Mon 21 Jan 2019 11:17:06 PM CET.
Dependencies resolved.
==========================================================================================
 Package     Arch      Version       Repository                                      Size
==========================================================================================
Installing:
 libknet1    x86_64    1.4-3.el8     rhel-8-for-x86_64-highavailability-htb-rpms     69 k

Transaction Summary
==========================================================================================
Install  1 Package

Total download size: 69 k
Installed size: 161 k
Downloading Packages:
libknet1-1.4-3.el8.x86_64.rpm                              45 kB/s |  69 kB     00:01    
------------------------------------------------------------------------------------------
Total                                                      45 kB/s |  69 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                  1/1 
  Installing       : libknet1-1.4-3.el8.x86_64                                        1/1 
  Running scriptlet: libknet1-1.4-3.el8.x86_64                                        1/1 
  Verifying        : libknet1-1.4-3.el8.x86_64                                        1/1 
Installed products updated.

Installed:
  libknet1-1.4-3.el8.x86_64                                                               

Complete!

[root@kvm-02-guest16 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

Product Name:   Red Hat Enterprise Linux High Availability High Touch Beta
Product ID:     236
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

Product Name:   Red Hat Enterprise Linux Resilient Storage High Touch Beta
Product ID:     238
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

[root@kvm-02-guest16 ~]# subscription-manager repos --disable=rhel-8-for-x86_64-highavailability-htb-rpms --disable=rhel-8-for-x86_64-resilientstorage-htb-rpms
Repository 'rhel-8-for-x86_64-highavailability-htb-rpms' is disabled for this system.
Repository 'rhel-8-for-x86_64-resilientstorage-htb-rpms' is disabled for this system.

[root@kvm-02-guest16 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

Product Name:   Red Hat Enterprise Linux High Availability High Touch Beta
Product ID:     236
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

Product Name:   Red Hat Enterprise Linux Resilient Storage High Touch Beta
Product ID:     238
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

[root@kvm-02-guest16 ~]# dnf install aide --assumeyes --nogpgcheck
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for x86_64 - AppStream HTB (RP 2.3 kB/s | 4.1 kB     00:01    
Red Hat Enterprise Linux 8 for x86_64 - BaseOS HTB (RPMs) 3.2 kB/s | 4.1 kB     00:01    
Dependencies resolved.
==========================================================================================
 Package   Arch        Version            Repository                                 Size
==========================================================================================
Installing:
 aide      x86_64      0.16-8.el8         rhel-8-for-x86_64-appstream-htb-rpms      155 k

Transaction Summary
==========================================================================================
Install  1 Package

Total download size: 155 k
Installed size: 374 k
Downloading Packages:
aide-0.16-8.el8.x86_64.rpm                                118 kB/s | 155 kB     00:01    
------------------------------------------------------------------------------------------
Total                                                     118 kB/s | 155 kB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                  1/1 
  Installing       : aide-0.16-8.el8.x86_64                                           1/1 
  Running scriptlet: aide-0.16-8.el8.x86_64                                           1/1 
  Verifying        : aide-0.16-8.el8.x86_64                                           1/1 
Installed products updated.

Installed:
  aide-0.16-8.el8.x86_64                                                                  

Complete!

[root@kvm-02-guest16 ~]# dnf list aide libknet1
Updating Subscription Management repositories.
Last metadata expiration check: 0:01:24 ago on Mon 21 Jan 2019 11:20:40 PM CET.
Installed Packages
aide.x86_64              0.16-8.el8           @rhel-8-for-x86_64-appstream-htb-rpms       
libknet1.x86_64          1.4-3.el8            @rhel-8-for-x86_64-highavailability-htb-rpms

[root@kvm-02-guest16 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

Product Name:   Red Hat Enterprise Linux High Availability High Touch Beta
Product ID:     236
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

Product Name:   Red Hat Enterprise Linux Resilient Storage High Touch Beta
Product ID:     238
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019


VERIFIED: The installed product certs from repos (rhel-8-for-x86_64-highavailability-htb-rpms and rhel-8-for-x86_64-resilientstorage-htb-rpms) remain installed despite their disablement while installing another package from repo rhel-8-for-x86_64-appstream-htb-rpms.


[root@kvm-02-guest16 ~]# subscription-manager repos --enable=rhel-8-for-x86_64-highavailability-htb-rpms --enable=rhel-8-for-x86_64-resilientstorage-htb-rpms
Repository 'rhel-8-for-x86_64-highavailability-htb-rpms' is enabled for this system.
Repository 'rhel-8-for-x86_64-resilientstorage-htb-rpms' is enabled for this system.

[root@kvm-02-guest16 ~]# yum remove aide libknet1 --assumeyes
Updating Subscription Management repositories.
Dependencies resolved.
==========================================================================================
 Package    Arch     Version         Repository                                      Size
==========================================================================================
Removing:
 aide       x86_64   0.16-8.el8      @rhel-8-for-x86_64-appstream-htb-rpms          374 k
 libknet1   x86_64   1.4-3.el8       @rhel-8-for-x86_64-highavailability-htb-rpms   161 k

Transaction Summary
==========================================================================================
Remove  2 Packages

Freed space: 535 k
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                  1/1 
  Erasing          : libknet1-1.4-3.el8.x86_64                                        1/2 
  Erasing          : aide-0.16-8.el8.x86_64                                           2/2 
  Running scriptlet: aide-0.16-8.el8.x86_64                                           2/2 
  Verifying        : aide-0.16-8.el8.x86_64                                           1/2 
  Verifying        : libknet1-1.4-3.el8.x86_64                                        2/2 
Installed products updated.

Removed:
  aide-0.16-8.el8.x86_64                     libknet1-1.4-3.el8.x86_64                    

Complete!

[root@kvm-02-guest16 ~]# subscription-manager list --installed
+-------------------------------------------+
    Installed Product Status
+-------------------------------------------+
Product Name:   Red Hat Enterprise Linux for x86_64 High Touch Beta
Product ID:     230
Version:        8.0 HTB
Arch:           x86_64
Status:         Subscribed
Status Details: 
Starts:         01/16/2019
Ends:           02/01/2019

VERIFIED: With the repos enabled (rhel-8-for-x86_64-highavailability-htb-rpms and rhel-8-for-x86_64-resilientstorage-htb-rpms), removal of package libknet1 also removes the installed product cert id from these repos because it is the only remaining package originating from these product repos.  Once the last package originating from a repo is removed, its product cert id from that repo is also removed.  When no packages from a product repo are installed, then the product is not installed.