Bug 2125227

Summary: [RFE] Guest user running yum command get system not registered message even when the system is actually registered.
Product: Red Hat Enterprise Linux 9 Reporter: Rupesh Patel <rupatel>
Component: subscription-managerAssignee: Jason Jerome <jajerome>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: low    
Version: 9.0CC: cdonnell, jsefler, redakkan, zpetrace
Target Milestone: rcKeywords: EasyFix, FutureFeature, Triaged
Target Release: 9.2   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: subscription-manager-1.29.31-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2134165 (view as bug list) Environment:
Last Closed: 2023-05-09 08:18: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:
Bug Depends On:    
Bug Blocks: 2134165    

Description Rupesh Patel 2022-09-08 11:42:18 UTC
Description of problem:

For Systems that are already registered using subscription-manager, while running yum install as a non-root user print message that the system is not registered along with required yum to run as root. 

This message doesn't seem accurate or misleading the guest users (even though it is correct that guest user can not install packages and required root)

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

Red Hat Enterprise Linux 9.0 

How reproducible:

Steps to Reproduce:

1. Installed fresh system
2. Register it using subscription-manager
3. log in as guest user
4. It says root is required but it also says the system is not registered which is not true. 

Actual results:

[rupesh@rupeshlap-redhat-com ~]$ yum install haproxy
Not root, Subscription Management repositories not updated
 
This system is not registered with an entitlement server. You can use subscription-manager to register.
 
Error: This command has to be run with superuser privileges (under the root user on most systems).
[rupesh@rupeshlap-redhat-com ~]$

 
Expected results:


[rupesh@rupeshlap-redhat-com ~]$ yum install haproxy
Not root, Subscription Management repositories not updated
 
Error: This command has to be run with superuser privileges (under the root user on most systems).
[rupesh@rupeshlap-redhat-com ~]$

Comment 3 Craig Donnelly 2022-10-19 15:38:51 UTC
>> Pre-verification against RHEL-9.2.0-20221017.0:

[root@rhel92 ~]# rpm -q subscription-manager
subscription-manager-1.29.30-1.el9.x86_64

[root@rhel92 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

System Purpose Status: Not Specified       

[root@rhel92 ~]# su - testuser
Last login: Wed Oct 19 11:28:49 EDT 2022 on pts/0

[testuser@rhel92 ~]$ yum install vim
Not root, Subscription Management repositories not updated
Error: This command has to be run with superuser privileges (under the root user on most systems).

>> LGTM, pre-verified.

Comment 4 Craig Donnelly 2022-10-19 15:43:42 UTC
>> For clarification, when unregistered the output is as such:

[root@rhel92 ~]# subscription-manager unregister
Unregistering from: subscription.rhsm.redhat.com:443/subscription
System has been unregistered.

[root@rhel92 ~]# su - testuser
Last login: Wed Oct 19 11:35:47 EDT 2022 on pts/0

[testuser@rhel92 ~]$ yum install vim
Not root, Subscription Management repositories not updated

This system is not registered with an entitlement server. You can use subscription-manager to register.

Error: There are no enabled repositories in "/etc/yum.repos.d", "/etc/yum/repos.d", "/etc/distro.repos.d".

Comment 7 Zdenek Petracek 2022-11-04 14:20:00 UTC
Final verification on SM version:
[root@kvm-02-guest04 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 4.2.10-1
subscription management rules: 5.43
subscription-manager: 1.29.31-1.el9

Registering the system:
[root@kvm-02-guest04 ~]# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: zpetracePH03
Password: 
The system has been registered with ID: ef44444a-1662-45f6-9972-e5d0618cd0b1
The registered system name is: kvm-02-guest04.rhts.eng.brq.redhat.com

[root@kvm-02-guest04 ~]# subscription-manager attach --auto
Installed Product Current Status:    
Product Name: Red Hat Enterprise Linux for x86_64 Beta
Status:       Subscribed

[root@kvm-02-guest04 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

System Purpose Status: Not Specified       

Switching to testuser and running yum command:
[root@kvm-02-guest04 ~]# su - testuser
Last login: Fri Nov  4 15:11:14 CET 2022 on pts/0

[testuser@kvm-02-guest04 ~]$ yum install zsh
Not root, Subscription Management repositories not updated
Error: This command has to be run with superuser privileges (under the root user on most systems).

^^ Final Verification PASSED - message "This system is not registered with an entitlement server. You can use subscription-manager to register." was not included

Comment 9 errata-xmlrpc 2023-05-09 08:18:42 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-2023:2493