Bug 1876841

Summary: reposync gives misleading ERROR message when run as a non-root user
Product: Red Hat Enterprise Linux 8 Reporter: Jiri Hladky <jhladky>
Component: subscription-managerAssignee: mhorky
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.2CC: aokuliar, james.antill, jhladky, jsefler, mhorky, osabart, redakkan
Target Milestone: rcKeywords: Triaged
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.28.20-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:37:33 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 Jiri Hladky 2020-09-08 10:24:58 UTC
Description of problem:

When running reposync as a non-root user I'm getting the following ERROR message even when run with with --repofrompath command line argument:

$reposync --repofrompath=tmp,http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/4.18.0/235.el8/ppc64le --repoid=tmp

2020-09-08 12:17:42,926 [ERROR] reposync:778211:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated
Added tmp repo from http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/4.18.0/235.el8/ppc64le
tmp  
 

This ERROR message is misleading. Could we remove it, at least for the situation when --repofrompath is used? 
                                                                                                                                         

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

$reposync --version
4.2.17


How reproducible:

Run as non-root user this command:
reposync --repofrompath=tmp,http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/4.18.0/235.el8/ppc64le --repoid=tmp


Actual results:

2020-09-08 12:17:42,926 [ERROR] reposync:778211:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated

Expected results:

No ERROR message.

Comment 1 Daniel Mach 2020-09-14 11:23:31 UTC
The error message seems to be generated by the subscription-manager plugin. Reassigning the component.

Comment 3 Rehana 2021-07-30 09:56:43 UTC
Reproducing the issue :
======================

# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.19-1
subscription management rules: 5.41
subscription-manager: 1.28.19-1.el8

Switch to non root user

$ reposync --repofrompath=tmp,http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/5.14.0/0.rc3.29.el9/x86_64/ --repoid=tmp
2021-07-30 05:52:29,893 [ERROR] reposync:40480:MainThread @logutil.py:221 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated

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

Added tmp repo from http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/5.14.0/0.rc3.29.el9/x86_64/
tmp                  

Preverifying the issue on :
===========================
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.19-1
subscription management rules: 5.41
subscription-manager: 1.28.19-1.git.6.c1dd7c3.el8

$ reposync --repofrompath=tmp,http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/5.14.0/0.rc3.29.el9/x86_64/ --repoid=tmp
Not root, Subscription Management repositories not updated
Added tmp repo from http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/5.14.0/0.rc3.29.el9/x86_64/
tmp      

$ tail ~/.cache/rhsm/rhsm.log -n 1
2021-07-30 12:55:08,209 [ERROR] reposync:84312:MainThread @identity.py:156 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 13] Permission denied: '/etc/pki/consumer/key.pem'

^^ Notice the log entry is now added to rhsm.log in the non-root user's home directory 

Based on the observation, preverifying the bug

Comment 7 Rehana 2021-08-09 14:46:04 UTC
Verifying on :
===============
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.19-1
subscription management rules: 5.41
subscription-manager: 1.28.20-1.el8

# rpm -qa subscription-manager --changelog | grep 1876841

# su - test
Last login: Mon Aug  9 10:40:02 EDT 2021 on pts/0

$ reposync --repofrompath=tmp,http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/5.14.0/0.rc3.29.el9/x86_64/ --repoid=tmp
Not root, Subscription Management repositories not updated
Added tmp repo from http://download.eng.bos.redhat.com/devel/task-repos/official/kernel/5.14.0/0.rc3.29.el9/x86_64/
tmp          

$ tail ~/.cache/rhsm/rhsm.log -n 1
2021-08-09 10:44:18,112 [ERROR] reposync:17869:MainThread @identity.py:156 - Reload of consumer identity cert /etc/pki/consumer/cert.pem raised an exception with msg: [Errno 13] Permission denied: '/etc/pki/consumer/key.pem'

Based on the above observation , moving the bug to Verified!!!

Comment 10 errata-xmlrpc 2021-11-09 19:37:33 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-2021:4390