Host registration or subscription-manager refresh command failed with "400 - Bad Request" after upgrade to Red Hat Satellite 6.8.5
Environment
- Red Hat Satellite 6.8.5 or older
- Red Hat Satellite 6.9.0
Issue
-
Registering new host or subscription manager refresh command fails with "400 - Bad Request" after upgrade to Satellite 6.8.5.
[root@rhel7-vm:~]#subscription-manager register --activationkey RHEL7 --org Example_Org The system has been registered with ID: 70620e3d-07dd-454a-8341-3b03468ad049 The registered system name is: rhel7-vm Network error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information. [root@rhel8-client:~]#subscription-manager refresh Network error. Please check the connection details, or see /var/log/rhsm/rhsm.log for more information. [root@rhel8-client:~]# [root@rhel8-client:~]#cat /var/log/rhsm/rhsm.log 2021-04-15 02:10:09,203 [ERROR] subscription-manager:922948:MainThread @managercli.py:218 - Unable to perform refresh due to the following exception: HTTP error (400 - Bad Request) 2021-04-15 02:10:09,203 [ERROR] subscription-manager:922948:MainThread @managercli.py:219 - HTTP error (400 - Bad Request) Traceback (most recent call last): File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 1058, in _do_command self.entcertlib.update() File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 32, in update self.report = self.locker.run(self._do_update) File "/usr/lib64/python3.6/site-packages/subscription_manager/certlib.py", line 18, in run return action() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 42, in _do_update return action.perform() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 119, in perform expected = self._get_expected_serials() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 292, in _get_expected_serials exp = self.get_certificate_serials_list() File "/usr/lib64/python3.6/site-packages/subscription_manager/entcertlib.py", line 272, in get_certificate_serials_list reply = self.uep.getCertificateSerials(identity.uuid) File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 1340, in getCertificateSerials return self.conn.request_get(method) File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 880, in request_get return self._request("GET", method, headers=headers, cert_key_pairs=cert_key_pairs) File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 906, in _request info=info, headers=headers, cert_key_pairs=cert_key_pairs) File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 765, in _request self.validateResponse(result, request_type, handler) File "/usr/lib64/python3.6/site-packages/rhsm/connection.py", line 863, in validateResponse raise NetworkException(response['status']) rhsm.connection.NetworkException: HTTP error (400 - Bad Request)
Resolution
-
The reported issue under
Red Hat BugzillasThis content is not included.1949353 has been fixed in the errata RHBA-2021:1261. Its clone for This content is not included.6.9.0 bug has been fixed in 6.9.1 errata. -
For detailed instructions on how to apply this update, refer to the documentation of 6.8 update or 6.9 update.
For more KB articles/solutions related to Red Hat Satellite 6.x Client Subscription Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Client Subscription Issues
Root Cause
-
Candlepin is trying to regenerate the SCA certificate(the payload part) when registering a host if there is a content update (CV published new version with new contents) but it didn't delete the existing one before regenerating the new one. Thus, causing the following duplicate key error in the log file
/var/log/candlepin/error.log. This issue is still being investigated under Bugzillla This content is not included.1949353.Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "cp_owner_env_content_access_ukey" Detail: Key (owner_id, environment_id)=(2c9a885c56a499ad0156a499f2550001, 669b578358ed8e0aa496a1dd985648fc) already exists. at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306) at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441) at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365) at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155) at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(PgPreparedStatement.java:132) at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:462) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:197) ... 83 common frames omitted
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.