postgres launch daemon not working

Scott Frankel frankel at circlesfx.com
Tue Jan 31 11:52:00 PST 2012


Hi Daniel,


On Jan 31, 2012, at 10:47 AM, Daniel J. Luke wrote:

> On Jan 31, 2012, at 12:55 PM, Scott Frankel wrote:
>> Google searches suggested that the plist file comes with the server, so I installed postgresql84-server @8.4.10_0, which indeed installed the plist file.  In contrast with installing '84, '84-server took only moments to complete installation.
>> 
>> Invoking launchctl to load the plist file, rebooting or not, then calling `psql` yields the familiar error:
>> 
>> 	psql: could not connect to server: No such file or directory
>> 		Is the server running locally and accepting
>> 		connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
> 
> did you follow the instructions to create a database instance that the postgresql84-server port printed?

Yes, I should've mentioned that.  The installation is perfectly functional once I start it manually; eg:

	% sudo su postgres -c "/opt/local/lib/postgresql84/bin/pg_ctl -D /opt/local/var/postgresql84/defaultdb -l /opt/local/var/postgresql84/defaultdb/data/logfile.txt start"


Previous to this installation, I had postgresql83 running on MacOSX 10.5 (also via macports) and its server started automatically on machine reboots.  Not sure why postgres84 on OSX 10.7 isn't behaving similarly.



> (incidentally, they should be moved to notes instead of post-install so that port notes postgresql84-server would print them again).

That'd be nice.


> It would have said something like this:
> 
> To create a database instance, after install do
> sudo mkdir -p /opt/local/var/db/postgresql84/defaultdb
> sudo chown postgres:postgres /opt/local/var/db/postgresql84/defaultdb
> sudo su postgres -c '$/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/db/postgresql84/defaultdb'
> 
> To tweak your DBMS, consider increasing kern.sysv.shmmax
> by adding an increased kern.sysv.shmmax .. to /etc/sysctl.conf
> 
>> Any suggestions?
> 
> 
> I believe if launchd has trouble starting something it will print some error text in /var/log/system.log

Thanks for the tip!

Jan 31 08:26:02 tiento org.macports.postgresql84-server[1920]: server starting
Jan 31 08:29:07 tiento com.apple.SystemStarter[53]: Starting PostgreSQL database server
Jan 31 08:29:07 tiento com.apple.SystemStarter[53]: pg_ctl: could not open PID file "/Library/PostgreSQL8/data/postmaster.pid": Permission denied
Jan 31 08:29:08 tiento SystemStarter[53]: PostgreSQL database server (90) did not complete successfully


Looks like pg_ctl is trying to open a postmaster.pid file it doesn't have permissions for.  How can I point launchd invocations of pg_ctl to the correct postgres data dir?  I initialized my db according to info I gleaned from searches; eg:

	% sudo su postgres \ -c '/opt/local/lib/postgresql84/bin/initdb -D /opt/local/var/postgresql84/defaultdb'


Prior to that, I reinstated the postgres user name with:

	% sudo dscl . -append /Users/postgres UniqueID 401


I assigned the postgres username to UID 401, as my previous installation's postgres files seemed to be owned by user 401 of group postgres.  I wonder if this is the source of the permissions problem.


Thanks!
Scott



> 
> --
> Daniel J. Luke                                                                   
> +========================================================+                        
> | *---------------- dluke at geeklair.net ----------------* |                          
> | *-------------- http://www.geeklair.net -------------* |                          
> +========================================================+                        
> |   Opinions expressed are mine and do not necessarily   |                          
> |          reflect the opinions of my employer.          |                          
> +========================================================+
> 
> 
> 
> 




More information about the macports-users mailing list