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 1823523

Summary: /usr/libexec/rhsmd throws ImportError: No module named psutil
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Chris Snyder <csnyder>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: high    
Version: 7.9CC: bkearney, candlepin-bugs, cdonnell, jhnidek, jneedle, pvlasin, rbiba, redakkan, skallesh, wpoteat
Target Milestone: rcKeywords: Regression, Triaged
Target Release: ---   
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-09-29 19:23:08 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: 1803794    

Description John Sefler 2020-04-13 21:03:56 UTC
Description of problem:
When attempting to run "/etc/cron.daily/rhsmd", an import error is thrown...

[root@hpe-dl380pgen8-02-vm-4 ~]# /etc/cron.daily/rhsmd
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 43, in excepthook_base
    sys.exit(0)
AttributeError: 'NoneType' object has no attribute 'exit'

Original exception was:
Traceback (most recent call last):
  File "/usr/libexec/rhsmd", line 9, in <module>
    load_entry_point('subscription-manager==1.24.32', 'console_scripts', 'rhsmd')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 55, in <module>
    import psutil
ImportError: No module named psutil



This is a regression from RHEL-7.8 and I suspect the following cherry-picked commit is the offender....
https://gitlab.sat.engineering.redhat.com/satellite6/subscription-manager/-/commit/44dd059d345b98044ace9704baa43745e61750aa
This commit introduced a new "import psutil" in src/subscription_manager/scripts/rhsm_d.py that was not present on rhel-7.8 and is now failing on rhel7.9.


Version-Release number of selected component (if applicable):
[root@hpe-dl380pgen8-02-vm-4 ~]# rpm -q --whatprovides /etc/cron.daily/rhsmd
subscription-manager-1.24.32-1.el7.x86_64

How reproducible:


Steps to Reproduce:
1. /etc/cron.daily/rhsmd
2.
3.

Actual results:
  ImportError: No module named psutil

Expected results:
  no error

Additional info:

Comment 13 Shwetha Kallesh 2020-05-13 08:21:37 UTC
Reproducer:

[root@kvm-07-guest13 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.9.27-1
subscription management rules: 5.37
subscription-manager: 1.24.36


[root@kvm-07-guest13 ~]# /etc/cron.daily/rhsmd
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 43, in excepthook_base
    sys.exit(0)
AttributeError: 'NoneType' object has no attribute 'exit'

Original exception was:
Traceback (most recent call last):
  File "/usr/libexec/rhsmd", line 9, in <module>
    load_entry_point('subscription-manager==1.24.36', 'console_scripts', 'rhsmd')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 55, in <module>
    import psutil
ImportError: No module named psutil
^C
[root@kvm-07-guest13 ~]# /usr/libexec/rhsmd --help
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 43, in excepthook_base
    sys.exit(0)
AttributeError: 'NoneType' object has no attribute 'exit'

Original exception was:
Traceback (most recent call last):
  File "/usr/libexec/rhsmd", line 9, in <module>
    load_entry_point('subscription-manager==1.24.36', 'console_scripts', 'rhsmd')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2566, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2260, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib64/python2.7/site-packages/subscription_manager/scripts/rhsm_d.py", line 55, in <module>
    import psutil
ImportError: No module named psutil

Comment 14 Shwetha Kallesh 2020-05-13 08:22:54 UTC
Verification :

Moving bug to verified as I dont see any error message


[root@hpe-dl380pgen8-02-vm-1 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.1.11-1
subscription management rules: 5.40
subscription-manager: 1.24.37
[root@hpe-dl380pgen8-02-vm-1 ~]# /etc/cron.daily/rhsmd
[root@hpe-dl380pgen8-02-vm-1 ~]# /usr/libexec/rhsmd --help
Usage: rhsmd [OPTIONS]

Options:
  -h, --help            show this help message and exit
  -d, --debug           Display debug messages
  -k, --keep-alive      Stay running (don't shut down after the first dbus
                        call)
  -s, --syslog          Run standalone and log result to syslog
  -f FORCE_SIGNAL, --force-signal=FORCE_SIGNAL
                        Force firing of a signal (valid, expired, warning,
                        partial, classic or registration_required)
  -i, --immediate       Fire forced signal immediately (requires --force-
                        signal)

Comment 16 errata-xmlrpc 2020-09-29 19:23:08 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 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:3866