Unable to Upgrade Red Hat Satellite 6.16 to 6.17 due to error 'PG::InsufficientPrivilege Error for Extension evr'
Environment
- Red Hat Satellite 6.16
- Red Hat Satellite 6.17
Issue
-
Unable to complete satellite upgrade to version 6.17.
-
Following error encountered during database migration.
/Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::InsufficientPrivilege: ERROR: must be owner of extension evr
Resolution
-
This issue has been reported to Red Hat Engineering team via This content is not included.JIRA SAT-34021 and is under investigation.
-
Meanwhile, Run the following commands to correct ownership of
evrextension.# runuser -l postgres -c \ "psql -d foreman -c \"UPDATE pg_extension SET extowner = (SELECT oid FROM pg_authid WHERE rolname='foreman') WHERE extname='evr';\"" -
Re-run the DB migration manually:
# foreman-rake db:migrate --trace -
If no further errors, Re-run the upgrade via
satellite-maintain. -
After the upgrade, verify the problematic migration has been successfully executed, otherwise errata applicability calculation will stop working. To verify, output of either command:
# su - postgres -c "psql foreman -c \"\d+ katello_rpms\"" | grep evr # su - postgres -c "psql foreman -c \"\d+ katello_installed_packages\"" | grep evrshould print some output (see the other KCS for the output).
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
-
Variable TMOUT check was whitelisted during the upgrade process:
Running foreman-maintain command with arguments [["upgrade", "run", "--whitelist=check-tmout-variable", "--assumeyes"]] -
That, in turn, resulted in the satellite-installer failing to check the existence of the foreman database, during the upgrade, and the
35-change-evr-extension-ownershiphook was never applied.
Diagnostic Steps
-
Check the installer logs for error:
2025-05-12 10:56:39 [DEBUG ] [root] Executing: runuser -l postgres -c psql\ -t\ -c\ \"SELECT\ 1\ FROM\ pg_database\ WHERE\ datname\ \=\ \'foreman\'\;\" 2025-05-12 10:56:40 [DEBUG ] [root] /etc/profile.d/tmout.sh: line 2: TMOUT: readonly variable 2025-05-12 10:56:40 [DEBUG ] [root] 1 2025-05-12 10:56:40 [DEBUG ] [root] 2025-05-12 10:56:40 [NOTICE] [pre] The Foreman database foreman does not exist. 2025-05-12 10:56:40 [DEBUG ] [pre] Hook /usr/share/foreman-installer/hooks/pre/35-change-evr-extension-ownership.rb returned true -
The db migrate logs showing:
== 20240903194428 AddPriorityToContentViewEnvironmentActivationKey: migrated (0.0013s) == 20240924161240 KatelloRecreateEvrConstructs: migrating ===================== -- extension_enabled?("evr") -> 0.9478s -- execute("DROP EXTENSION evr CASCADE;\n") change from 'notrun' to ['0'] failed: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] rake aborted! StandardError: An error has occurred, this and all later migrations canceled: PG::InsufficientPrivilege: ERROR: must be owner of extension evr -
Check 'extowner' value using following command:
# runuser -l postgres -c "psql -d foreman -c \"select * from pg_extension;\"" oid | extname | extowner | extnamespace | extrelocatable | extversion | extconfig | extcondition -------+---------+----------+--------------+----------------+------------+-----------+-------------- 14372 | plpgsql | 10 | 11 | f | 1.0 | | 16908 | evr | 10 | 2200 | t | 0.0.2 | |
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.