Subscription manager issue when trying to register new content host foreman-katello

Foreman is new to me so please bare with me. We are setting this up as a proof of concept for content management and provisioning for our Linux based systems.

Problem:
Subscription manager issue when trying to register new host foreman-katello

I am trying to register a new content host to Foreman using these steps:

curl --insecure --output katello-ca-consumer-latest.noarch.rpm https://someserver/pub/katello-ca-consumer-latest.noarch.rpm
yum localinstall katello-ca-consumer-latest.noarch.rpm

subscription-manager register --org=“Default_Organization” --activationkey=“somekeyname”

After running the subscription manager command I receive the following error:
Unable to find Subscription Manager module.
Error: No module named M2Crypto

Foreman and Proxy versions:
Version 1.20.1

**Katello plugin version
katello 3.10.0

Other relevant data:
Trying to run this on CentOS Linux release 7.0.1406 (Core)

Hey @lbetson, a few questions:

  • what os and version is the host? Is that the CentOS Linux release 7.0.1406?
  • What version of subscription-manager?
  • How are you installing subscription-manager?

My first thought is that this is an issue in Centos 7.0, is there any reason to use such an old minor version? I think 7.6 is the latest

  • OS version of the host is latest: CentOS Linux release 7.6.1810 (Core)

  • Well, I am following the directions within my Foreman host for registering a new content host. The version installed, subscription-manager-1.21.10-3.el7.centos.x86_64.

So I am doing this first: curl --insecure --output katello-ca-consumer-latest.noarch.rpm https://myserver/pub/katello-ca-consumer-latest.noarch.rpmyum localinstall katello-ca-consumer-latest.noarch.rpm
Next I am doing this: subscription-manager register --org=“Default_Organization” --activationkey="" … and that is when I get the error in regards to the subscription manager.

We have 100s of Linux server that have been neglected, not patched, etc. Which is one of the reasons we want to use Foreman to patch our servers. Does Foreman have an issue registering older host versions of CentOS, like 6 & 7? I sure hope not.

When I run the command again this is the output:
[root@someserver ~]# subscription-manager register --org=“Default_Organization” --activationkey=“CentOS7”
Unable to find Subscription Manager module.
Error: No module named M2Crypto

Thanks for the info. Do you have the m2crypto rpm installed?

alternatively register using username and password like this:

subscription-manager register --username=“admin” --password=“YOURPASSWORD” --org=“Default_Organization” --environment=“Library”

I do have the M2crypto installed same issue. I also receive the error if I register with the Username and Password. Thank you.

@lbetson, one thing you can check on the client system: which python

I think the version you want is 2.6. Does it reveal that it’s an alias to 2.7 or some other version? Feel free to share output here. If it is an alias you can rectify the problem like so:

unalias python
ln -f -v /usr/bin/python2.6 /usr/bin/python

I’ve read about this somewhere on RedHat Access, but I highly doubt this for EL7 distros.
RHEL7 and CentOS7 come with python2.7 as default. Taking a quick look on our RHEL7 Systems, I could not even find a packaged version of python 2.6. Also we have been using subscritption-manager with the default Python 2.7 for some years now without problems.

I can do a registration via activation keys just fine using these versions on RHEL7:

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.9.1-Unknown
subscription management rules: 5.30.1
subscription-manager: 1.21.10-3.el7_6
# python --version
Python 2.7.5
# /usr/bin/python --version
Python 2.7.5

hello everyone I have a problem when making a maager subscription against my katello foreman server

[root@fhi0250chkmk0a rhsm]# subscription-manager register --org=“IBD-COHI” --activationkey=“IBD-COHI-RH7-PROD”
Error de servidor remoto. Por favor revise los detalles de conexión o consulte /var/log/rhsm/rhsm.log para obtener más información.

2021-05-25 16:20:01,796 [INFO] subscription-manager:242339:MainThread @connection.py:909 - Connection built: http_prox
y:8085=proxybi.corp.iberdrola.com host=fhi0250rhsat01.cohi.iberdrola.com port=443 handler=/rhsm auth=none
2021-05-25 16:20:02,056 [ERROR] subscription-manager:242339:MainThread @connection.py:647 - Response: 404
2021-05-25 16:20:02,057 [ERROR] subscription-manager:242339:MainThread @connection.py:648 - JSON parsing error: No JSO
N object could be decoded
2021-05-25 16:20:02,057 [ERROR] subscription-manager:242339:MainThread @managercli.py:217 - Error durante el registro:
Server error attempting a POST to /rhsm/consumers?owner=IBD-COHI&activation_keys=IBD-COHI-RH7-PROD returned status 40
4
2021-05-25 16:20:02,057 [ERROR] subscription-manager:242339:MainThread @managercli.py:218 - Server error attempting a
POST to /rhsm/consumers?owner=IBD-COHI&activation_keys=IBD-COHI-RH7-PROD returned status 404
can help me to locate where the problem may be
Thnks in advance
Ricardo