Windows – Error1053 trying to start postgres as service on windows

postgresqlservicewindows

I installed postgres on windows7 and tried to start the service through control panel. It produces error 1053.

When I try to run postgres.exe from command line, I get this message:

C:\Program Files (x86)\PostgreSQL\9.0\bin>postgres.exe
2011-07-24 14:02:29 IST LOG:  could not create file "postmaster.opts": Permission denied

The default data directory is

C:\Program Files (x86)\PostgreSQL\9.0\data

I have set the PGDATA env variable to the above directory.

Also, I have edited the pg_hba.conf file in that directory to add a new line as below:

local   all postgres    ident  sameuser

I tried to start the service with postgresql server allowed (both private and public networks ticked) in Windows Firewall, and when that didn't solve the problem, turned off the firewall for both public and private networks..

Still the service cannot be started. I tried disabling the AVG resident shield. None of these worked.

Any idea what to do?


update:

I tried this:

C:\Program Files (x86)\PostgreSQL\9.0\bin>pg_ctl restart
pg_ctl: PID file "C:/Program Files (x86)/PostgreSQL/9.0/data/postmaster.pid" does not exist
Is server running?
starting server anyway
server starting

C:\Program Files (x86)\PostgreSQL\9.0\bin>2011-07-24 16:12:57 IST LOG:  could not create file "postmaster.opts":

Still no luck.

As for the logs, I found 2 txt files in folder data/pg_log. They contain logs of events immediately after installation, not my later attempts at starting postgres. I have put it here.

In windows event viewer, I get a series of error event entries like http://pastebin.com/K6jUPPAy. All of them contain messages similar to:

2011-07-24 12:46:44 IST FATAL:  could not access status of transaction
0 2011-07-24 12:46:44 IST DETAIL:  Could not open file
"pg_notify/0000": Permission denied.

If there are any other logs, please tell me where I can find them.

Best Answer

This is just a guess, but maybe PostgreSQL directory is set to be read-only. Read this post for more.