-
Bug
-
Resolution: Done-Errata
-
Major
-
6.17.0
While https://projects.theforeman.org/issues/37717 and https://github.com/theforeman/foreman-installer/commit/d4a78ffa234286a1f595b5f47665f9fd74f581ee might already have addressed the issue in the installer, but a presence of read-only TMOUT environment variable can still result into failure during upgrade as the ownership of the evr extension would not be fixed.
Steps to reproduce:
- Install a Sat 6.16 normally
- Create /etc/profile.d/tmout.sh with the following content.
TMOUT=900 readonly TMOUT export TMOUT
- If needed, add the same in .bashrc of root as well.
- Logout and log back in
- Try to upgrade to Satellite 6.17 with this option added
--whitelist=non-rh-packages,check-tmout-variable
Actual Behavior:
The upgrade starts fine but when installer is finally executed, The pre-hook fails to fix the ownership of evr extension:
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
That further results in failure during the db:migrate step
2025-05-12 11:03:03 [ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] 2025-05-12 11:03:03 [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] 2025-05-12 11:03:53 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Failed to call refresh: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] 2025-05-12 11:03:53 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] 2025-05-12 11:05:03 [NOTICE] [configure] 2500 configuration steps out of 2515 steps complete. 2025-05-12 11:05:10 [NOTICE] [configure] System configuration has finished. Error 1: Puppet Exec resource 'foreman-rake-db:migrate' failed. Logs: /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate] Adding autorequire relationship with User[foreman] Starting to evaluate the resource (2268 of 2515) Failed to call refresh: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0] Evaluated in 107.70 seconds Exec[foreman-rake-db:migrate](provider=posix) Executing check '/usr/sbin/foreman-rake db:abort_if_pending_migrations' Executing '/usr/sbin/foreman-rake db:migrate' Executing check '/usr/sbin/foreman-rake db:abort_if_pending_migrations' Executing '/usr/sbin/foreman-rake db:migrate' .. .. Run `bin/rails db:migrate` to update your database then try again. You have 14 pending migrations: 20240924161240 KatelloRecreateEvrConstructs 20241007200316 AddFieldsToKatelloDockerManifestList 20241007212705 AddBootcFactsToContentFacet 20241022121706 AddSyncDependenciesOption 20241025151105 RemovePulp3MigratedHrefsFromContentTables 20241030181402 CreateKatelloFlatpakTables 20241101144625 RemoveSystemPurposeAddons 20241107002541 AddRegistryURLToKatelloFlatpakRemotes 20241112145802 AddManifestEntityToContentFacets 20241120213713 AddAllowOtherTypesToContentViewErratumFilterRules 20241126150849 RemoveRemoteExecutionWorkersPoolSize 20241206183052 AddContentTypeToContainerManifestsAndLists 20241217190624 AddUniqueIndexToRuleIdAndHostIdInInsightsHits 20241220184900 ChangeSyncInsightsRecommendationsToTrue /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 /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `exec' /usr/share/gems/gems/activerecord-7.0.8.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:48:in `block (2 levels) in execute' /usr/share/gems/gems/activesupport-7.0.8.7/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
Expected Behavior:
No such issues at all.
Additional Note:
The issue can be fixed by executing this
- runuser -l postgres -c \
"psql -d foreman -c \"UPDATE pg_extension SET extowner = (SELECT oid FROM pg_authid WHERE rolname='foreman') WHERE extname='evr';\""
and then re-executing the upgrade.
- clones
-
SAT-34021 Printing output in profile.d breaks upgrading to Red Hat Satellite 6.17 fails with PG::InsufficientPrivilege: ERROR: must be owner of extension evr
-
- Release Pending
-
- is blocked by
-
SAT-34945 Fixes #38492 - don't fail to detect local db if there is other output by evgeni · Pull Request #1026 · theforeman/foreman-installer · GitHub
-
- Closed
-
- links to
-
RHBA-2025:151800 Satellite 6.17.2 Async Update