Satellite upgrade fails at db:migrate step with error PG::InsufficientPrivilege: ERROR: must be owner of table foreman_tasks_recurring_logics
Environment
- Red Hat Satellite 6
Issue
-
Satellite upgrade fails with below error.
[ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from 'notrun' to ['0'] failed: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] -
Running
foreman-rake db:migratefails with below error# foreman-rake db:migrate --trace ** Execute db:migrate == 20210987654321 AddPurposeToRecurringLogic: migrating ======================= -- add_column(:foreman_tasks_recurring_logics, :purpose, :string) rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::InsufficientPrivilege: ERROR: must be owner of table foreman_tasks_recurring_logics
Resolution
-
Fix the owner for table
foreman_tasks_recurring_logicstoforeman.# su - postgres -c 'psql foreman' foreman=# ALTER TABLE public.foreman_tasks_recurring_logics OWNER to foreman; foreman=# exit -
Run
# foreman-rake db:migrateagain and ensure it is successful.
For more KB articles/solutions related to Red Hat Satellite 6.x Installation/Upgrade/Update Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Installation/Upgrade/Update Issues.
Root Cause
- The
foreman_tasks_recurring_logicstable has wrong owner. The expected owner of this table is supposed to be the userforeman.
Diagnostic Steps
-
Run below command on Satellite to get list of all table and owners in Postgres database.
# echo "select tablename,tableowner from pg_tables where schemaname = 'public';" |su - postgres -c 'psql foreman'
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.