Katello - 422 error while trying to register

Problem:
While trying to run a command:
subscription-manager register --org=“Organization” --activationkey=SomeKey
I get following error:
“HTTP error (422 - Unknown): Please unregister or remove hosts which match this host before registering: hostname”
Foreman and Plugin versions:
Foreman 1.22.0
Katello 3.12.2

Other relevant data:
Tried following on node:
“subscription-manager unregister” and got
“This system is currently not registered.”
Node is not registered according to foreman UI and hammer, tried even:
“hammer host subscription unregister --host hostname” and got
“Could not unregister the host:
Host has not been registered with subscription-manager”

any workarounds how i could still register the host? This definetly is a big issue for me.

Hi @ats,

Do you already have a host named ‘hostname’ in Foreman?

No, this is completely new machine and neither do existing ones have the same name as new one.
The only thing i did was delete it once because of misconfiguration on my part. Then added it again but i dont think subscription was attached when i first deleted it.

Can you double check that there are no hosts with the name ‘hostname’ in the hosts list? This is confusing since that name is being reported in the error message you shared which indicates that there is a record with that name.

1 Like

There are definitely no server names overlapping. The thing that worked for me was to delete the host from foreman&clean certs from puppet once again. Then first register myself in Katello and then add myself back to puppet&foreman:
“The system has been registered with ID: e9cda8d5-03a6-4121-df36-2f68bc34b626
The registered system name is: hostname
No products installed.”
Normal process for me would be to add the host first into puppet&foreman and then register myself in katello.

The thing that worked for me was to delete the host from foreman&clean certs from puppet once again

It sounds like there was in fact a host with that name already otherwise there would not be anything to delete in Foreman. That’s why the ‘hostname’ is being reported in the error message and also why removing it allowed you to register the host once again.

The reason this error message is shown is because the DMI/BIOS UUID being reported at registration time did not match the host already in Foreman/Katello. I suspect you created the host in Foreman then attempted to register to it with subscription-manager from the client? This workflow will be fixed in upcoming 3.12.3 and 3.13.0 by this: Bug #27580: Katello fails to register hosts that were "pre-registered" via the API - Katello - Foreman The description isn’t what you described but the change in the code fixes this use case. We’ve also improved the error message in that case to make it much more clear!

I’m having trouble following this logic, after reading the related bug reports.

  1. I spin up a new Katello server and the only host it has is itself (katello.mydomain.com). Configure products, etc.
  2. I spin up a new VM (client.mydomain.com)
  3. I attempt to join it with bootstrap.py
  4. A new host entry shows up in All hosts and Content hosts, before failing on the client side

HTTP error (422 - Unknown): Please unregister or remove hosts which match this host before registering: client.mydomain.com

Is the current 3.12 release broken then if this is expected behavior?

@imphocused Katello 3.12.3 was just released today: Katello 3.12.3 is now available!

It contains the fix for the scenario you mentioned. Please upgrade and enjoy :slight_smile:

1 Like

I ran into some issues with upgrading (puppet timeout it looks like), but since it was a new install, I just wiped it and started fresh. All good so far. Thanks for the followup!

Glad to hear that!

3.12.3 didn’t fix this problem for us, and I see people saying the same on the Satellite BZ entry:
https://bugzilla.redhat.com/show_bug.cgi?id=1732891

We get something like:

$ sudo subscription-manager register --org='Acme_Corp' --activationkey='CentOS-7-Base-Live'
HTTP error (422 - Unknown): This host is reporting a DMI UUID that differs from the existing registration.

@John_Beranek to clarify this error message is a valid one but we fixed some scenarios where it was being thrown when it should not have been. Let’s figure out which scenario you’re running to see if the error message is correct:

  • Are you registering a new content host? (does it already have a profile in the UI?)
  • What is the exact workflow you’re doing? Are you manually registering your host, kickstarting it?
  • If there is a profile for this host already in the UI, is it registered, and have you tried unregistering it from the UI or with the Hammer CLI ?

Hosts are registered by a Chef recipe after they are deployed, using an activation key.

We get the issue if a host is deployed, then decommissioned and another host with the same hostname deployed and attempted to be registered with Katello.

We can unregister the host from the UI but that rather interrupts the automated nature of our Katello registrations!

Keep in mind that you can use the CLI or API to remove the old host.

However, this behavior will change in a way that will work for you in Katello 3.13.1 (3.13.0 will be out very soon but won’t contain the changes) which I expect to be released later this month. This registration scenario, by default, will not be blocked so long as the host UUID is unique even if it’s changed. There will be a new setting to opt-into this blocking behavior that you’re observing.