Description of problem: Rarely when you are doing `./install.pl --upgrade --managed-db` it might fail. Version-Release number of selected component (if applicable): Satellite-5.7.0-RHEL6-re20150108.2-x86_64 How reproducible: rarely (seen once and done about 10 runs of the command) Steps to Reproduce: 1. # /mnt/tmp/install.pl --upgrade --managed-db Actual results: # /mnt/tmp/install.pl --upgrade --managed-db * Starting Red Hat Satellite installer. * Performing pre-install checks. * Pre-install checks complete. Beginning installation. * RHN Registration. ** Registration: System is already registered with RHN. Not re-registering. * Upgrading managed DB packages. *** Upgrading embedded database. There was a problem during embedded database upgrade. Exit value: 2. Please examine /var/log/rhn/rhn_installation.log for more information. # tail /var/log/rhn/rhn_installation.log Running Transaction Installing : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64 1/1 Verifying : postgresql92-postgresql-upgrade-9.2.8-2.el6.x86_64 1/1 Installed: postgresql92-postgresql-upgrade.x86_64 0:9.2.8-2.el6 Complete! Starting postgresql service: [ OK ] psql: FATAL: the database system is starting up When I have re-ran /usr/bin/spacewalk-upgrade-postgresql manually, upgrade passed. Expected results: Should work Additional info: This is a code-path: ### /mnt/tmp/install.pl: [...] if ($opts{"upgrade"} and $opts{"managed-db"}) { install_satellite_repo(\%opts); print loc("* Upgrading managed DB packages.\n"); install_embedded_postgresql(\%opts); Spacewalk::Setup::postgresql_upgrade_embedded_db(); print loc("* Managed DB instance was successfully upgraded.\n"); exit 0; } [...] ### /mnt/tmp/install/lib/Spacewalk/Setup.pm: [...] sub postgresql_upgrade_embedded_db { print loc("*** Upgrading embedded database.\n"); system_or_exit(['/usr/bin/spacewalk-upgrade-postgresql', ''], 1, "There was a problem during embedded database upgrade.\n"); return 0; } [...] ### /usr/bin/spacewalk-upgrade-postgresql: [...] service postgresql start DB_TIMEZONE=$(echo "show timezone;" | psql -U $DB_USER -d $DB_NAME -h localhost | sed -n 3p | sed 's/ //g') LOG_TIMEZONE=$(echo "show log_timezone;" | psql -U $DB_USER -d $DB_NAME -h localhost | sed -n 3p | sed 's/ //g') service postgresql stop [...] So looks like we are trying to stop PostgreSQL 8.4 right after we have started and we are not checking result of the commands betweet that start and stop so its results can be empty or something.
Reported bug 1188942, which might be relevant.
Pavel Raiskup mentioned PostgreSQL initscript configuration option which can achieve that. Problem is that it appears in rh-postgresql94 from RHSCL-2.0: bug 1188942 comment #3
We have re-reviewed this bug, as part of an ongoing effort to improve Satellite/Proxy feature and bug updates, review and backlog. This is a low priority bug and has no currently open customer cases. While this bug may still valid, we do not see it being implemented prior to the EOL of the Satellite 5.x product. As such, this is being CLOSED DEFERRED.