Problem:
I need to migrate my installation from Rocky 8 to Rocky 9. in-place is not a feasible option in this case.
I’m getting errors on duplicate keys for errata packages:
reindexdb: reindexing database "candlepin"
reindexdb: reindexing database "foreman"
reindexdb: error: processing of database "foreman" failed: ERROR: could not create unique index "katello_erratum_packages_eid_nvrea_n_f"
DETAIL: Key (erratum_id, nvrea, name, filename)=(51779, gcc-objc-4.8.2-16.2.el7_0.x86_64, gcc-objc, gcc-objc-4.8.2-16.2.el7_0.x86_64.rpm) is duplicated.
CONTEXT: parallel worker
I have deleted all EL7 repositories, content-views and products.
On deleting the Products i also got another error, when i force completed that the product still disappeared from the list, but its stuck in limbo somewhere as when i run “foreman-rake katello:clean_candlepin_orphaned_products” it returns an error (same as task showed).
[root@foreman ~]# foreman-rake katello:clean_candlepin_orphaned_products
Cleaning Candlepin orphaned custom products for organization my_org
Deleting Candlepin orphaned custom product 847803058025 (and its associated pools and subscriptions)
rake aborted!
ForemanTasks::TaskError: Task fd143ecd-e065-4e9d-b3a7-4b924ba8a5f8: Katello::Errors::CandlepinError: Product "847803058025" cannot be deleted while referenced by one or more subscriptions
/usr/share/gems/gems/foreman-tasks-9.2.3/lib/foreman_tasks.rb:56:in `block in sync_task'
/usr/share/gems/gems/foreman-tasks-9.2.3/lib/foreman_tasks.rb:55:in `tap'
/usr/share/gems/gems/foreman-tasks-9.2.3/lib/foreman_tasks.rb:55:in `sync_task'
/usr/share/gems/gems/katello-4.14.0/lib/katello/tasks/clean_candlepin_orphaned_products.rake:26:in `block (4 levels) in <top (required)>'
/usr/share/gems/gems/katello-4.14.0/lib/katello/tasks/clean_candlepin_orphaned_products.rake:16:in `each'
/usr/share/gems/gems/katello-4.14.0/lib/katello/tasks/clean_candlepin_orphaned_products.rake:16:in `block (3 levels) in <top (required)>'
/usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/delegation.rb:88:in `each'
/usr/share/gems/gems/activerecord-6.1.7.8/lib/active_record/relation/delegation.rb:88:in `each'
/usr/share/gems/gems/katello-4.14.0/lib/katello/tasks/clean_candlepin_orphaned_products.rake:7:in `block (2 levels) in <top (required)>'
/usr/share/gems/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
Tasks: TOP => katello:clean_candlepin_orphaned_products
(See full trace by running task with --trace)
Expected outcome:
Reindex works
Foreman and Proxy versions:
Katello 4.14
foreman 3.12
Foreman and Proxy plugin versions:
Distribution and version:
Rocky 8
Other relevant data:
This might be related to another issue i’m having with removing a broken Manifest
I can start the manifest removal job, but it hangs at 0% forever and is only stoppable with warning status be restarting foreman (or more likely the postgres) through “foreman-maintain service restart”
The when doesnt matter, i’ve tried with most services offline, everything online, while nothing is happening on the system, always the same error.
The how:
runuser -u postgres – reindexdb -a
There are 1.5 things wrong currently with backup and restore to a new instance.
When doing a full backup with this command:
foreman-maintain backup offline --assumeyes --preserve-directory /mnt/backup/
There is no pgsql_data.tar.gz created. I’ve semi-“solved” it by taking the DB offline, tar-ing it mysel with
tar --selinux -czvf /mnt/backup/pgsql_data.tar.gz /var/lib/pgsql/data/
that seemed to have worked.
But the bigger issue is that when the restore is reindexing the DB on destination host, it hits the exact same issue with reindexing, so i figured i could fix it on my old system before retrying the move.
There is perhaps another option if its somehow possible.
Since this system has been around for a while, starting its life as OL7, migrated to CentOS 7, Leapped to Rocky8 and gone through so, so many version upgrades of Foreman/Katello
Can i somehow export all the hostgroup and puppet env/class + per host parameter changes and import that to a new instance?
if that is possible i can simply set up a brand new instance and import those settings for my ~450 hosts and then redo all the content stuff from scratch.