Subscription-manager register error in katello 3.15.3.1

Problem:
subscription manager fails with following error:

[root@HOSTNAME ~]# subscription-manager register --org="Default_Organization" --activationkey="HIDDEN"
HTTP error (422 - Unprocessable Entity): Validation failed: Title has already been taken

tail of production.log is:

2020-07-15T12:28:53 [I|app|89c32787] Import facts for 'HOSTNAME' completed. Added: 160, Updated: 0, Deleted 0 facts
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on host_id 16
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on uuid 3172531c-3858-4517-bdc2-3f2b05602a25
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on service_level
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on release_version
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on autoheal false
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on registered_at 2020-05-15 21:07:41 UTC
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on registered_through
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on user_id
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on hypervisor false
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on hypervisor_host_id
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on purpose_usage
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on purpose_role
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on dmi_uuid 41F92242-7FFB-59FC-784D-02E53785CB96
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (21) destroy event on pool_ids []
2020-07-15T12:28:54 [I|aud|89c32787] Host::Base (5) update event on uuid 3172531c-3858-4517-bdc2-3f2b05602a25,
2020-07-15T12:28:54 [E|kat|89c32787] <Class> ActiveRecord::RecordInvalid
2020-07-15T12:28:54 [E|kat|89c32787] title: ["has already been taken"]
2020-07-15T12:28:54 [I|app|89c32787] Completed 422 Unprocessable Entity in 3519ms (Views: 0.2ms | ActiveRecord: 1469.8ms)

Expected outcome:

A successful subscription

Foreman and Proxy versions:

foreman 2.0.1
katello 3.15.3.1

Foreman and Proxy plugin versions:

katello 3.15.3.1
foreman-tasks 1.1.3

Distribution and version:

[root@HOSTNAME ~]# cat /etc/redhat-release
CentOS Linux release 8.2.2004 (Core)

Other relevant data:

Perhaps related to this old ticket: Validation failed: Name Operating system version already exists, Title has already been taken while trying to register physical server. The OS info in foreman was previously populated by puppet agent.

@Jonathon_Turel I see you were involved in this thread - is @mattatjgi experiencing a related issue? Any updates since that thread?

@mattatjgi can you provide the output of:

hammer os list from your Katello server, and subscription-manager facts | grep distribution from the client facing the registration problem?

Sure, here it is:

$ hammer os list
---|-----------------------|--------------|-------
ID | TITLE                 | RELEASE NAME | FAMILY
---|-----------------------|--------------|-------
4  | CentOS 7.7.1908       |              | Redhat
1  | CentOS 7.8.2003       |              | Redhat
2  | CentOS 8              |              | Redhat
3  | CentOS 8.0.1905       |              | Redhat
8  | CentOS 8.2.2004       |              | Redhat
9  | openSUSE Leap 15.0    |              | Suse
6  | openSUSE Leap 15.1    |              | Suse
7  | Scientific Linux 6.10 |              | Redhat
5  | Scientific Linux 6.6  |              | Redhat
11 | Scientific Linux 6.7  |              | Redhat
10 | Ubuntu 18.04.3 LTS    | bionic       | Debian
---|-----------------------|--------------|-------

# subscription-manager facts | grep distribution
distribution.id: Core
distribution.name: CentOS Linux
distribution.version: 8
distribution.version.modifier: Unknown

# rpm -qa | grep subsc
dnf-plugin-subscription-manager-1.26.17-1.el8_2.x86_64
python3-subscription-manager-rhsm-1.26.17-1.el8_2.x86_64
subscription-manager-1.26.17-1.el8_2.x86_64
subscription-manager-rhsm-certificates-1.26.17-1.el8_2.x86_64

@mattatjgi thank you. I need some more information if you can provide it:

On your Katello server, run foreman-rake console and provide the output of this command:

Operatingsystem.where(id: [2,3,8])

I’m trying to get my data set up in the same way that yours is, to reproduce the problem.

Thanks for looking into this. Here’s the info:

# foreman-rake console
API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
Loading production environment (Rails 5.2.1)
irb(main):001:0> Operatingsystem.where(id: [2,3,8])
=> #<ActiveRecord::Relation [#<Redhat id: 2, major: "8", name: "CentOS", minor: "1.1911", nameindicator: nil, created_at: "2020-06-06 02:50:37", updated_at: "2020-06-06 02:50:37", release_name: "", type: "Redhat", description: "CentOS 8", password_hash: "SHA256", title: "CentOS 8">, #<Redhat id: 3, major: "8", name: "CentOS", minor: "0.1905", nameindicator: nil, created_at: "2020-06-11 17:30:39", updated_at: "2020-06-11 17:30:39", release_name: nil, type: "Redhat", description: nil, password_hash: "SHA256", title: "CentOS 8.0.1905">, #<Redhat id: 8, major: "8", name: "CentOS", minor: "2.2004", nameindicator: nil, created_at: "2020-06-25 18:51:17", updated_at: "2020-07-15 19:03:02", release_name: "", type: "Redhat", description: "", password_hash: "SHA256", title: "CentOS 8.2.2004">]>

No problem. I see the problem in the data you provided. The title of this OS is incorrect:

#<Redhat id: 2, major: "8", name: "CentOS", minor: "1.1911", nameindicator: nil, created_at: "2020-06-06 02:50:37", updated_at: "2020-06-06 02:50:37", release_name: "", type: "Redhat", description: "CentOS 8", password_hash: "SHA256", title: "CentOS 8">

It should be ‘CentOS 8.1.1911’ rather than just ‘Centos 8’. If you no longer have hosts associated to this OS you could remove it. If you view it in the UI and press ‘Submit’ to save it, that may actually correct the title. Give it a try and let me know how it goes.

1 Like

ok, I had to save “CentOS 8.1.1911” in the OS description and that fixed it. Thanks!

2 Likes

I filed an issue so the root cause can be found and fixed : Bug #30485: OS can be saved with incorrect title - Foreman