subscription-manager fails with cryptography error in RHEL 8.5

Latest response

I accidentally deleted my system from the redhat consumer portal that linked it to my developer subscription.

According to the instructions, the way to get it back was to issue the "subscription-manager register --username myuser --password mypassword --auto-attach' command.

The problem is that I receive an error anytime I use subscription-manager with the register command:

[root@ares ~]# subscription-manager register --username myuser --password mypassword --auto-attach
module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'
[root@ares ~]#

Any suggestions for how to make this work?



I finally solved my problem trying to use ‘subscription-manager register’ failing with the message “module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'”.

I observed that dnf routinely lists a similar message, as it has for a long time, although the dnf commands all appear to succeed (unlike subscription-manager). The dnf warning has a little more information, including ‘Failed loading plugin “spacewalk”’:

[root@ares ~]# dnf repolist
Failed loading plugin "spacewalk": module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'
Updating Subscription Management repositories.
Unable to read consumer identity
repo id                                                       repo name
Plex                                                          Plex
convert2rhel-for-rhel-8-rpms                                  Convert2RHEL for OS 8
epel                                                          Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                  Extra Packages for Enterprise Linux Modular 8 - x86_64
forensics                                                     CERT Forensics Tools Repository
forensics-splunk                                              CERT Forensics Tools Repository - Splunk
rhel-8-for-x86_64-appstream-rpms                              Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
rhel-8-for-x86_64-baseos-rpms                                 Red Hat Enterprise Linux 8 for x86_64 - BaseOS (RPMs)
rpmfusion-free-updates                                        RPM Fusion for EL 8 - Free - Updates
rpmfusion-nonfree-updates                                     RPM Fusion for EL 8 - Nonfree - Updates

So I looked at the plugins, and was able to find one called “spacewalk”, although it was disabled:

[root@ares ~]# ls -l /etc/dnf/plugins
total 28
-rw-r--r--. 1 root root  351 Apr 12  2021 copr.conf
drwxr-xr-x. 2 root root 4096 Mar 18 11:30 copr.d
-rw-r--r--. 1 root root   30 Apr 12  2021 debuginfo-install.conf
-rw-r--r--  1 root root   24 Jan 18 09:53 kpatch.conf
-rw-r--r--  1 root root   17 Apr 13 11:19 product-id.conf
-rw-r--r--  1 root root  177 Jun  9 16:00 spacewalk.conf.rpmsave
-rw-r--r--  1 root root  213 Apr 13 11:19 subscription-manager.conf

[root@ares ~]# cat /etc/dnf/plugins/spacewalk.conf.rpmsave 
enabled = 0
gpgcheck = 1
timeout = 120

# You can specify options per channel, e.g.:
#enabled = 1
#gpgcheck = 0

[root@ares ~]# dnf list installed | grep spacewalk
Failed loading plugin "spacewalk": module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'
dnf-plugin-spacewalk.noarch                      2.8.5-11.module+el8.1.0+3455+3ddf2832          @rhel-8-for-x86_64-appstream-rpms
python3-dnf-plugin-spacewalk.noarch              2.8.5-11.module+el8.1.0+3455+3ddf2832          @rhel-8-for-x86_64-appstream-rpms
[root@ares plugins]# dnf list installed | grep cryptography
Failed loading plugin "spacewalk": module 'lib' has no attribute 'Cryptography_HAS_TLSEXT_HOSTNAME'
python3-cryptography.x86_64                      3.3-1                                          @forensics                       

Next, I decided to remove the spacewalk plugin:

[root@ares ~]# dnf remove dnf-plugin-spacewalk

And this worked! I no longer get the error, and can successfully use subscription-manager, and no longer get the message using dnf, either.

We're glad you got this fixed Michael!

Thanks for sharing what worked for you too