Bug 1749668

Summary: HTTP error (404 - Not Found) when running #subscription-manager register
Product: [Community] Candlepin Reporter: Mike Cao <bcao>
Component: candlepinAssignee: candlepin-bugs
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: low Docs Contact:
Priority: low    
Version: 2.9CC: bcao, bdumont, brault, broskos, casantos, csnyder, ealcaniz, gpadholi, jdandrea, jgammon, jobuckle, khowell, ktordeur, mkolman, mscherer, mschmidt, nmoumoul, patalber, qianzhan, redakkan, rrajaram, shivagup, smajumda, swilson, wpoteat, ylifshit
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: candlepin-2.9.0-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-08 11:53:07 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mike Cao 2019-09-06 08:07:34 UTC
Description of problem:
Failed to register a system to subscription manager

Version-Release number of selected component (if applicable):
# rpm -qa|grep rhsm 
subscription-manager-rhsm-certificates-1.24.13-1.el7.x86_64
subscription-manager-rhsm-1.24.13-1.el7.x86_64
[root@dell-m620-07 rhsm]# rpm -qa|grep kernel
kernel-headers-3.10.0-1062.el7.x86_64
kernel-3.10.0-1062.el7.x86_64
kernel-tools-libs-3.10.0-1062.el7.x86_64
cakernel-tools-3.10.0-1062.el7.x86_64


How reproducible:
100%

Steps to Reproduce:
1.Fresh install RHEL7.7
2.#subscription-manager register 
3.

Actual results:
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: rhn-support-bcao
Password: 
HTTP error (404 - Not Found): Unit with ID "ab72ebd8-9306-4a16-89d5-edfe7f92c2be" could not be found.

Expected results:
registered successfully


Additional info:
#cat /var/log/rhsm/rhsm.log
2019-09-06 04:01:30,672 [INFO] rhsmd:37087:MainThread @rhsm_d.py:280 - rhsmd started
2019-09-06 04:01:30,714 [INFO] subscription-manager:37075: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
2019-09-06 04:01:30,737 [INFO] subscription-manager:37075:MainThread @managercli.py:462 - X-Correlation-ID: cdececabd273438b9e0e57b37d731208
2019-09-06 04:01:30,738 [INFO] subscription-manager:37075:MainThread @managercli.py:351 - Client Versions: {'subscription-manager': '1.24.13-1.el7'}
2019-09-06 04:01:30,738 [INFO] subscription-manager:37075: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
2019-09-06 04:01:30,739 [INFO] subscription-manager:37075:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=none
2019-09-06 04:01:30,740 [INFO] subscription-manager:37075:MainThread @managercli.py:351 - Client Versions: {'subscription-manager': '1.24.13-1.el7'}
2019-09-06 04:01:30,767 [INFO] subscription-manager:37075:MainThread @managercli.py:327 - Consumer Identity name=None uuid=None
2019-09-06 04:01:30,771 [INFO] subscription-manager:37075:MainThread @managercli.py:327 - Consumer Identity name=None uuid=None
2019-09-06 04:02:33,608 [INFO] subscription-manager:37075:MainThread @connection.py:905 - Connection built: host=subscription.rhsm.redhat.com port=443 handler=/subscription auth=basic username=rhn-support-bcao
2019-09-06 04:02:37,168 [INFO] subscription-manager:37075:MainThread @connection.py:618 - Response: status=200, requestUuid=86bfeb16-2c47-4d63-8b05-892947e333a8, request="GET /subscription/users/rhn-support-bcao/owners"
2019-09-06 04:02:38,242 [INFO] subscription-manager:37075:MainThread @connection.py:618 - Response: status=200, request="GET /subscription/"
2019-09-06 04:02:38,274 [INFO] subscription-manager:37075:MainThread @dmiinfo.py:76 - Using dmidecode dump file: /dev/mem
2019-09-06 04:02:42,566 [INFO] subscription-manager:37075:MainThread @connection.py:618 - Response: status=404, requestUuid=6baf4199-b5af-48e8-9dc5-9730a780d91c, request="POST /subscription/consumers?owner=1979710"
2019-09-06 04:02:42,567 [ERROR] subscription-manager:37075:MainThread @managercli.py:1335 - HTTP error (404 - Not Found): Unit with ID "ab72ebd8-9306-4a16-89d5-edfe7f92c2be" could not be found.
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/subscription_manager/managercli.py", line 1332, in _do_command
    type=self.options.consumertype
  File "/usr/lib64/python2.7/site-packages/rhsmlib/services/register.py", line 91, in register
    usage=usage
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 1011, in registerConsumer
    return self.conn.request_post(url, params)
  File "/usr/lib64/python2.7/site-packages/rhsm/connection.py", line 729, in request_post
    return self._request("POST", 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 689, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: HTTP error (404 - Not Found): Unit with ID "ab72ebd8-9306-4a16-89d5-edfe7f92c2be" could not be found.

Comment 3 Mike Cao 2019-09-06 08:10:49 UTC
This host works find with to register to a satellite server.
it only occurs to register to the production subscription server subscription.rhsm.redhat.com:443/subscription.

Comment 8 William Poteat 2019-09-12 16:00:47 UTC
Can you give the actual CLI commands used for this scenario, please?

Are you using --force or --consumerid options?
Was the client previously registered?

Comment 9 Mike Cao 2019-09-17 03:12:54 UTC
Hi, William

Can you check comment #7.
That's all the actual commands I use, I did not use --force or --consumerid 

Need to mention that my manager's id and mines are belonging to the same account. but her account has the admin role
after register system by using #subscription-manager register via her account and then #subscription-manager unregister. then my account can register this host successfully.

Cheers,
MIke

Comment 13 soham 2019-11-08 09:58:01 UTC
Received the same error while registering a server to satellite. Re-installing the katello-ca-consumer fixed the issue.

Regards,
Soham Majumdar

Comment 14 Kevin Howell 2019-11-14 16:36:04 UTC
Dev, please investigate if there is a possible code path where the scenario described in comment 9 is problematic.

Comment 15 patalber 2019-11-26 20:49:55 UTC
(In reply to soham from comment #13)
> Received the same error while registering a server to satellite.
> Re-installing the katello-ca-consumer fixed the issue.
> 
> Regards,
> Soham Majumdar

This also fixed my customer's issue. We will get a KCS written and linked here.

The odd part about the fix was that yum would hang in the pre-installation phase, but the 'rpm -Uvh' method was able to install the katello-ca-consumer RPM successfully.

--Patrick

Comment 17 Bertrand 2019-12-12 14:34:02 UTC
Hello,
I am facing a similar issue trying to register a RHEL 7.7 server (No Satellite server).

Using one account, I am able to register. But with my the other account I can't:

Failed attempt with b user
[root@workstation ~]# subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: b***
Password: 
HTTP error (404 - Not Found): Unit with ID "cb9d28cd-6657-4612-8473-8be47331568e" could not be found.
[root@workstation ~]# 

Successful attempt with r user.
[root@workstation ~]# subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: r***
Password: 
The system has been registered with ID: d3df458b-b7b9-44a0-880a-bbdca59987a8
The registered system name is: workstation.lab.example.com
[root@workstation ~]# 


uname -a
Linux workstation.lab.example.com 3.10.0-1062.9.1.el7.x86_64 #1 SMP Mon Dec 2 08:31:54 EST 2019 x86_64 x86_64 x86_64 GNU/Linux
[root@workstation ~]# 

It really seem to be tight to the user....

Any guidance here?

Thanks
Bertrand

Comment 20 Joe D'Andrea 2020-01-29 00:50:18 UTC
Greetings! I am experiencing the same issue under RHEL 7.7 (Maipo):

# subscription-manager register
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: rhn-gps-jdandrea
Password: 
HTTP error (404 - Not Found): Unit with ID "a0bcc45c-7425-4fb5-8be2-de9e14f5ab21" could not be found.

/var/log/rhsm/rhsm.log shows:

2020-01-28 19:35:14,079 [ERROR] subscription-manager:2829:MainThread @managercli.py:945 - Error: Unable to retrieve org list from server: HTTP error (401 - Unauthorized): Identifiants d'utilisateur non valides

Then, upon trying a POST /subscription/consumers?owner=11009103 (which matches my org key per "subscription-manager orgs" after AuthN), the log shows:

2020-01-28 19:40:58,761 [ERROR] subscription-manager:2899:MainThread @managercli.py:1335 - HTTP error (404 - Not Found): Unit with ID "a0bcc45c-7425-4fb5-8be2-de9e14f5ab21" could not be found.

Will investigate to see what may be up with me being unauthorised (it's a relatively new rhn-gps account).

Comment 23 M. Scherer 2020-03-10 11:42:47 UTC
So, for people who are impacted, the work around is to:
* go on https://access.redhat.com/management/systems
* add your system
* use "subscription-manager register --username=happyuser --password=p4ssw0rd  --consumerid=the_uuid_of_the_system

I kinda think that the doc could say that "consumerid" is what the online system call "uuid". As someone seldomly subscription manager, this took me a long time to figure.

Comment 26 John Gammon 2020-04-20 20:26:36 UTC
so I am getting this on rhel7.8 -- manual install --t rying to register this to my redhat login "jgammon1" and I tried using the suggestion -- i think the consumerid is me not the system -- in any case -- i just want acces to the yum repos for updates. The above solution did not work -- it gives me the same consumer id with <whatever the uuid> is not fopund

Comment 27 Yuval Lifshitz 2020-07-09 09:40:25 UTC
(In reply to M. Scherer from comment #23)
> So, for people who are impacted, the work around is to:
> * go on https://access.redhat.com/management/systems
> * add your system
> * use "subscription-manager register --username=happyuser
> --password=p4ssw0rd  --consumerid=the_uuid_of_the_system
> 
> I kinda think that the doc could say that "consumerid" is what the online
> system call "uuid". As someone seldomly subscription manager, this took me a
> long time to figure.

thanks, this worked for me. 
however, what is the root cause for sending the wrong UUID in the initial request?

Comment 28 swilson 2020-08-10 22:38:55 UTC
(In reply to M. Scherer from comment #23)
> So, for people who are impacted, the work around is to:
> * go on https://access.redhat.com/management/systems
> * add your system
> * use "subscription-manager register --username=happyuser
> --password=p4ssw0rd  --consumerid=the_uuid_of_the_system
> 
> I kinda think that the doc could say that "consumerid" is what the online
> system call "uuid". As someone seldomly subscription manager, this took me a
> long time to figure.

Confirmation. Adding system as new system to https://access.redhat.com/management/systems and registering the system with the generated UUID for the webiste.

` subscription-manager register --consumerid=<UUID from https://access.redhat.com/management/systems> `

Good job!

Comment 35 Nikos Moumoulidis 2022-12-08 11:53:07 UTC
The main issue described by this BZ (registration failing with 404 because of lack of privileges on the user) has been fixed for a long time now,
by returning a 403 (forbidden) and an appropriate message: "<username> is not authorized to register with organization <org_key>".
The BZ was accidentally left open, so I am closing it now.

If anyone is seeing 404 errors during registration, it will be for different reasons. In that case, please open a separate BZ with the specific details of your situation so we can troubleshoot.