I installed postgresql 9.2 from add-apt-repository ppa:pitti/postgresql using apt-get install postgresql-9.2

At the end of the install and every time I try to launch postgresql by using the following command

/etc/init.d/postgresql start


service postgresql start

I get this error:

Error: could not exec /usr/lib/postgresql/9.2/bin/pg_ctl    
/usr/lib/postgresql/9.2/bin/pg_ctl start -D /var/lib/postgresql/9.2/main -l 
/var/log/postgresql/postgresql-9.2-main.log -s -o  -c 
config_file="/etc/postgresql/9.2/main/postgresql.conf" :
invoke-rc.d: initscript postgresql, action "start" failed.
dpkg: error processing postgresql-9.2 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have tried everything found here: How to thoroughly purge and reinstall postgresql on ubuntu and here: Eliminating non working postgresql installations on ubuntu 10-04 and starting af.

I have also done

dpkg -P --force-remove-reinstreq postgresql-client-9.2

in my attempt to remove everything postgres related from my server.

After removing postgresql I have used

dpkg --get-selections | grep postg

To be sure there is nothing left and I can do a clean install.

I have also made sure that the files and folders mentioned in the error message have the right permissions. The /var/log/postgresql/postgresql-9.2-main.log file is empty. I have tried installing every postgresql version from 8.3 to 9.2 and I get the same error on every time. I once managed to compile postgresql from the source provided on their website but then I encountered weird errors with psycopg2 so I figured I'd install postgresql this way and avoid those errors. Also when I type apt-get install postgresql it by default tries to install the 8.3 version even when I can find the package by typing apt-get install postgresql-9.2.


I found the answer to my own question. I had a Zend installation on my server that interfered with the installation process and caused the error. Since I don't need Zend, I removed it and made sure anything Zend related was removed, by typing:

"rm -r /usr/local/zend"

after which Postgresql installed and started smoothly. I can't recommend this solution if you need your Zend but for me it worked. I hope this will help people in a similar situation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.