Unable to refresh subscriptions on VM: HTTP 400

Latest response

I'm running an RHEL 8.3 physical system, with various VMs, including an RHEL 7.7 VM (this is 'merlin-rhel-7' in the log below).

On the Customer Portal, I can see that both systems have a 'Red Hat Developer Subscription for individuals' attached. The VM sub expires on 2021-10-30, and last checked in on 2020-05-18.

Problem: the VM cannot 'yum install', and 'yum repolist all' shows that I can't access any repositories (the physical system has no problems):

[root@merlin-rhel-7 me]# yum repolist all
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions.

*** WARNING ***
The subscription for following product(s) has expired:
   ...[lots of products]
You no longer have access to the repositories that provide these products.  It is important that you apply an active subscription in order to resume access to security and other critical updates. If you don't have other active subscriptions, you can renew the expired subscription.

'subscription-manager' is not doing anything useful. 'subscription-manager register' says that I am already registered, but anything else comes back with a network error message. The rhsm.log extract below shows an attempt to refresh.

Does anyone have any idea how I can get yum working again? Thanks.

2021-05-05 10:22:37,649 [INFO] subscription-manager:2128:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2021-05-05 10:22:37,655 [INFO] subscription-manager:2128:MainThread @managercli.py:462 - X-Correlation-ID: fcb76d8ab6f6409baba1afb8c72899d7
2021-05-05 10:22:37,655 [INFO] subscription-manager:2128:MainThread @managercli.py:351 - Client Versions: {'subscription-manager': '1.24.13-1.el7'}
2021-05-05 10:22:37,655 [INFO] subscription-manager:2128:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2021-05-05 10:22:37,655 [INFO] subscription-manager:2128:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=none
2021-05-05 10:22:37,656 [INFO] subscription-manager:2128:MainThread @managercli.py:327 - Consumer Identity name=merlin-rhel-7.fubar.com uuid=73563ae6-7ec9-4445-a217-c942bfb5bb30
2021-05-05 10:22:38,638 [INFO] subscription-manager:2128:MainThread @connection.py:618 - Response: status=400, request="PUT /subscription/consumers/73563ae6-7ec9-4445-a217-c942bfb5bb30/certificates?lazy_regen=true"
2021-05-05 10:22:38,638 [ERROR] subscription-manager:2128:MainThread @connection.py:643 - Response: 400
2021-05-05 10:22:38,639 [ERROR] subscription-manager:2128:MainThread @connection.py:644 - JSON parsing error: No JSON object could be decoded
2021-05-05 10:22:38,639 [ERROR] subscription-manager:2128:MainThread @managercli.py:189 - Unable to perform refresh due to the following exception: HTTP error (400 - Bad Request)
2021-05-05 10:22:38,639 [ERROR] subscription-manager:2128:MainThread @managercli.py:190 - HTTP error (400 - Bad Request)
Traceback (most recent call last):

Responses

Hi Evan,

With every renewal of the Red Hat Developer Subscription for Individuals the Pool-ID changes and the sub has to be re-attached.
The problem is that your subscription expired between the last login of the VM and now, perform the following steps on the VM. :)

Un-register the system :

sudo subscription-manager remove --all
sudo subscription-manager unregister
sudo subscription-manager clean

Re-register the system :

sudo subscription-manager register
sudo subscription-manager refresh

Search for the Pool ID :

sudo subscription-manager list --available

Attach the subscription :

sudo subscription-manager attach --pool=<Pool-ID>

Regards,
Christian

Hi Christian - unfortunately, I can't do this; the 'remove' op fails with the same network error (log below). This is the same error as before - I can connect to subscription.rhsm.redhat.com, but it responds with a 400 code. The python code expects a JSON response, but it can't find one, so I just get a generic error message.

Thanks.

2021-05-05 12:35:51,428 [INFO] subscription-manager:2411:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2021-05-05 12:35:51,434 [INFO] subscription-manager:2411:MainThread @managercli.py:462 - X-Correlation-ID: 0c93a3b354564a229425e6fefd08c101
2021-05-05 12:35:51,434 [INFO] subscription-manager:2411:MainThread @managercli.py:351 - Client Versions: {'subscription-manager': '1.24.13-1.el7'}
2021-05-05 12:35:51,435 [INFO] subscription-manager:2411:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=identity_cert ca_dir=/etc/rhsm/ca/ insecure=False
2021-05-05 12:35:51,435 [INFO] subscription-manager:2411:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=none
2021-05-05 12:35:51,435 [INFO] subscription-manager:2411:MainThread @managercli.py:327 - Consumer Identity name=merlin-rhel-7.fubar.com uuid=73563ae6-7ec9-4445-a217-c942bfb5bb30
2021-05-05 12:35:52,379 [INFO] subscription-manager:2411:MainThread @connection.py:618 - Response: status=400, request="DELETE /subscription/consumers/73563ae6-7ec9-4445-a217-c942bfb5bb30/entitlements"
2021-05-05 12:35:52,379 [ERROR] subscription-manager:2411:MainThread @connection.py:643 - Response: 400
2021-05-05 12:35:52,379 [ERROR] subscription-manager:2411:MainThread @connection.py:644 - JSON parsing error: No JSON object could be decoded
2021-05-05 12:35:52,379 [ERROR] subscription-manager:2411:MainThread @managercli.py:189 - Unable to perform remove due to the following exception: HTTP error (400 - Bad Request)
2021-05-05 12:35:52,379 [ERROR] subscription-manager:2411:MainThread @managercli.py:190 - HTTP error (400 - Bad Request)
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1940, in _do_command
    total = ent_service.remove_all_entitlements()
  File "/usr/lib64/python2.7/site-packages/rhsmlib/services/entitlement.py", line 340, in remove_all_entitlements
    response = self.cp.unbindAll(self.identity.uuid)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1351, in unbindAll
    return self.conn.request_delete(method)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 738, in request_delete
    return self._request("DELETE", method, params, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 752, in _request
    info=info, headers=headers)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 627, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 713, in validateResponse
    raise NetworkException(response['status'])
NetworkException: HTTP error (400 - Bad Request)

Hi Evan,

Possibly this knowledgebase article helps : https://access.redhat.com/solutions/200153 ... I wish you good luck. :)

Regards,
Christian

Hi Evan,

I found another knowledgebase article : https://access.redhat.com/solutions/5338451 ... this seems to fit better. :)

Regards,
Christian

Hi Christian - you're a star. That's not actually the answer, but it's close.

  • /etc/pki/product on my system was empty; no files or directories
  • /etc/pki/product-default contained a '69.pem' certificate
  • I ran the 'subscription-manager identity --regenerate --force' command at the bottom of the page
  • This succeeded, and /etc/pki/product now contains the default pem file
  • 'subscription-manager refresh' now works, and I can run yum

Thanks.

[root@merlin-rhel-7 evan]# subscription-manager identity --regenerate --force
Username: ...
Password: ...
Identity certificate has been regenerated.
[root@merlin-rhel-7 evan]# subscription-manager refresh
1 local certificate has been deleted.
All local data refreshed

You're welcome, Evan ! Glad it could help you. :)

Regards,
Christian