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.
Interesting. I was under the impression registering RHEL8 against a Sat 5 deployment was unsupported.
In any case, the fix remains the same. +1 to dropping the rhn calls in the redhat policy entirely and just going with hostname.
Minimalistic code workaround:
sed -i.orig "s/self.rhn_username() or //g" /usr/lib/python3.6/site-packages/sos/policies/redhat.py
(to revert the change, either reinstall sos package or "/usr/bin/mv /usr/lib/python3.6/site-packages/sos/policies/redhat.py{.orig,}" )
The problem happens on RHEL8 or mor precisely with python3, only. Since:
$ python2.7
Python 2.7.15 (default, Oct 15 2018, 15:24:06)
[GCC 8.1.1 20180712 (Red Hat 8.1.1-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 'admin'.encode('utf-8', 'ignore').split('.')[0]
'admin'
>>>
vs.:
$ python3.6
Python 3.6.8 (default, Mar 21 2019, 10:08:12)
[GCC 8.3.1 20190223 (Red Hat 8.3.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 'admin'.encode('utf-8', 'ignore').split('.')[0]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: a bytes-like object is required, not 'str'
>>>
For QE: reproducer without the need to register to sat5 (to mock the registration):
dnf install rhn-setup # loads some required python libs, from RHEL8 BaseOS and AppStream repos
echo '<?xml version="1.0"?> <params> <param> <value><struct> <member> <name>username</name> <value><string>admin</string></value> </member> </struct></value> </param> </params>' > /etc/sysconfig/rhn/systemid
sosreport # whatever params
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, 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/RHEA-2019:3640
Description of problem: sosreport fails almost immediately when run on RHEL8 13154 11:14:48.809396 read(5</usr/lib/python3.6/site-packages/sos/policies/__init__.py>, "", 8192) = 0 <0.000003> 13154 11:14:48.809428 close(5</usr/lib/python3.6/site-packages/sos/policies/__init__.py>) = 0 <0.000016> 13154 11:14:48.809494 write(2</dev/pts/0<char 136:0>>, "Traceback (most recent call last):\n", 35) = 35 <0.000048> 13154 11:14:48.809604 write(2</dev/pts/0<char 136:0>>, " File \"/usr/lib/python3.6/site-packages/sos/sosreport.py\", line 991, in prework\n self._set_archive()\n", 105) = 105 <0.000043> 13154 11:14:48.809676 write(2</dev/pts/0<char 136:0>>, " File \"/usr/lib/python3.6/site-packages/sos/sosreport.py\", line 448, in _set_archive\n self.policy.get_archive_name())\n", 122) = 122 <0.000031> 13154 11:14:48.809733 write(2</dev/pts/0<char 136:0>>, " File \"/usr/lib/python3.6/site-packages/sos/policies/__init__.py\", line 387, in get_archive_name\n name = self.get_local_name().split('.')[0]\n", 145) = 145 <0.000029> 13154 11:14:48.809798 write(2</dev/pts/0<char 136:0>>, "TypeError: a bytes-like object is required, not 'str'\n", 54) = 54 <0.000029> 13154 11:14:48.809887 getpid() = 13154 <0.000003> 13154 11:14:48.809929 write(4</var/tmp/sos.rwoc_ae1/tmp4c0pz6pk>, "2019-06-03 11:14:48,809 ERROR: a bytes-like object is required, not 'str'\n", 74) = 74 <0.000008> 13154 11:14:48.809957 lseek(4</var/tmp/sos.rwoc_ae1/tmp4c0pz6pk>, 0, SEEK_CUR) = 970 <0.000003> 13154 11:14:48.809983 write(1</dev/pts/0<char 136:0>>, "a bytes-like object is required, not 'str'\n", 43) = 43 <0.000024> The following patch appears to correct the issue: --- /usr/lib/python3.6/site-packages/sos/policies/__init__.py 2019-01-21 18:12:16.000000000 +0100 +++ /usr/lib/python3.6/site-packages/sos/policies/__init__.py 2019-06-05 09:32:22.006000000 +0200 @@ -384,7 +384,7 @@ in the name_pattern in the format accepted by strftime(). """ - name = self.get_local_name().split('.')[0] + name = self.get_local_name().decode().split('.')[0] case = self.case_id label = self.commons['cmdlineopts'].label rand = ''.join(random.choice(string.ascii_lowercase) for x in range(7))