Bug 708662

Summary: Package does not create a suitable data dir
Product: [Fedora] Fedora Reporter: afanen01
Component: postgresqlAssignee: Tom Lane <tgl>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 15CC: devrim, hhorak, tgl
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-28 19:03:54 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description afanen01 2011-05-28 17:29:17 UTC
Description of problem:
Installing the postgresql-server package does not create a data dir, which causes the service to fail to start.

Version-Release number of selected component (if applicable): 9.04


How reproducible: always.


Steps to Reproduce:
1. Install postgresql-server
2. try to start the service using "service postgresql start"
  
Actual results:
it fails with a message advising you to view system logs. The logs do not contain useful information

Expected results:
It starts successfully, or shows pertinent information in the system log

Additional info:
If you create the folder "/var/lib/pgsql/data" and assign ownership to /var/lib/pgsql/* to user "postgres" and then run command "service postgresql start", it works successfully

Comment 1 Devrim Gündüz 2011-05-28 19:03:54 UTC
This is not a bug. Run

service postgresql initdb

before starting up the server. It will give you this message:

               echo $"$PGDATA is missing. Use \"service postgresql initdb\" to initialize the cluster first."

when you don't create anything on your own.

Comment 2 Tom Lane 2011-05-28 19:13:56 UTC
It's not a bug that you have to do a manual "service postgresql initdb" before "service start" will succeed.  That's an intentional safety feature.  We used to have logic in the initscript to do an automatic initdb if the data directory seemed to not be there, but it was removed after a couple of disastrous cases of the auto-initdb overwriting someone's database :-(

Now, it *is* a bug that you don't see the message suggesting that you need to do "service initdb".  But that's not the postgresql package's fault; it's the fault of systemd, which is intentionally routing all diagnostic output from initscripts to /dev/null.  See bug #622663 for some of the complaining about the fact that F15 has gone live without any solution for that problem.

Comment 3 Tom Lane 2011-05-28 19:14:18 UTC

*** This bug has been marked as a duplicate of bug 622663 ***