Bug 964323

Summary: postgresql installation fails when external DB already exists and needs clearing
Product: [Community] Spacewalk Reporter: Michele Baldessari <michele>
Component: InstallationAssignee: Milan Zázrivec <mzazrivec>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: low Docs Contact:
Priority: low    
Version: 1.10CC: jpazdziora, michele
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-03-04 13:08:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1069560    

Description Michele Baldessari 2013-05-17 21:08:09 UTC
Description of problem:
When launching spacewalk-setup --disconnected --external-db I get (am using today's nightly rpms on F18):
 spacewalk-setup --disconnected --external-db
** Database: Setting up database connection for PostgreSQL backend.
Could not connect to the database.  Your connection information may be incorrect.  Error: DBI connect('dbname=rhnschema','rhnuser',...) failed: FATAL:  Peer authentication failed for user "rhnuser" at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1683.

Hostname (leave empty for local)? localhost
Port [5432]? 
Database? spacewalk
Username? spacewalk
Password? 
** Database: Populating database.
The Database has schema.  Would you like to clear the database [Y]? 
** Database: Clearing database.
** Database: Shutting down spacewalk services that may be using DB.
** Database: Services stopped.  Clearing DB.
DBD::Pg::db do failed: FATAL:  terminating connection due to administrator command
FATAL:  terminating connection due to administrator command at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
DBD::Pg::db do failed: no connection to the server at /usr/share/perl5/vendor_perl/Spacewalk/Setup.pm line 1141, <STDIN> line 6.
** Database: Re-populating database.
*** Progress: #
Could not populate database.

So in order to clear the DB it shuts it down but then loses the connection

Version-Release number of selected component (if applicable):
postgresql-contrib-9.2.4-1.fc18.x86_64
spacewalk-setup-embedded-postgresql-1.10.1-1.fc18.noarch
spacewalk-backend-sql-postgresql-1.10.32-1.fc18.noarch
postgresql-server-9.2.4-1.fc18.x86_64
postgresql-libs-9.2.4-1.fc18.x86_64
postgresql-jdbc-9.2.1002-1.fc18.noarch
spacewalk-postgresql-1.9.2-1.fc18.noarch
spacewalk-java-postgresql-1.10.76-1.fc18.noarch
postgresql-9.2.4-1.fc18.x86_64

Comment 1 Jan Pazdziora 2013-05-20 09:14:46 UTC
I assume that you previously had the embedded PostgreSQL installation on that machine and only then changed to the "external" approach (albeit with the PostgreSQL server on the same box).

As a result, your /etc/rhn/service-list likely lists the postgresql database and that's why it got stopped. Could you check the content of /etc/rhn/service-list and see if removing the postgresql record helps?

Comment 2 Michele Baldessari 2013-05-22 19:03:24 UTC
Hi Jan,

that did fix it yes and indeed I did toy with the embedded version before and
yes (see my other two BZs) I did manage to completely miss the https://fedorahosted.org/spacewalk/wiki/PostgreSQLServerSetup guide.

I guess we can close this one out. Do you want me to document these errors in the wiki somewhere?

cheers,
Michele

Comment 3 Jan Pazdziora 2013-05-24 09:33:06 UTC
(In reply to Michele Baldessari from comment #2)
> 
> that did fix it yes and indeed I did toy with the embedded version before and
> yes (see my other two BZs) I did manage to completely miss the
> https://fedorahosted.org/spacewalk/wiki/PostgreSQLServerSetup guide.
> 
> I guess we can close this one out. Do you want me to document these errors
> in the wiki somewhere?

Bugs belong to bugzilla. ;-)

I'd leave this one open -- the developers might want to add removal of the embedded db entry if the subsequent spacewalk-setup run is not the embedded db one.

Thank you, Jan

Comment 4 Milan Zázrivec 2014-01-03 15:07:21 UTC
Fixed in spacewalk.git master: abbab01f79d77849763ac21aae268302e197f181

Comment 5 Matej Kollar 2014-01-17 12:16:07 UTC
Switching MODIFIED Spacewalk bugs to ON_QA before 2.1 release.

Comment 6 Matej Kollar 2014-03-04 13:08:21 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21

Comment 7 Matej Kollar 2014-03-04 13:09:05 UTC
Spacewalk 2.1 has been released.
https://fedorahosted.org/spacewalk/wiki/ReleaseNotes21