I recently installed kali Linux and keep getting an error code starting metasploit this is the code

[...] Starting PostgreSQL 9.1 database server: main
[...] Error: could not exec /usr/lib/postgresql/9.1/bin/pg_ctl /usr/lib/postgresql/9.1/bin/pg_ctl start -D /var/lib/postgresql/9.1/main -l /var/log/postgresql/postgresql-9.1-main.log -s -[FAILconfig_file="/etc/postgresql/9.1/main/postgresql.conf": ... failed!

Would really appreciate a solution been stuck for awhile.


This thread had the same issue as yours and the OP provides how they were able to resolve it. The thread was titled: Server 9.1 doesn't restart and no output/log - data files seem corrupted.


I managed to solve the problem.

For the record, I did the following:

 $ mkdir -p ~/postgresql/{etc,lib,log} 
 $ cp -a /etc/postgresql/9.1/main ~/postgresql/etc/old-install 
 $ cp -a /var/lib/postgresql/9.1/main ~/postgresql/lib/old-install 
 $ cp -a /var/log/postgresql ~/postgresql/log/old-install 

 $ apt-get remove --purge postgresql-9.1 postgresql-client-9.1 \
    postgresql-client-common postgresql-common 
 $ rm -rf /etc/postgresql 
 $ rm -rf /var/lib/postgresql 

 $ apt-get install postgresql 
 $ service postgresql stop 

 $ cp -a /etc/postgresql/9.1/main ~/postgresql/etc/new-install 
 $ cp -a /var/lib/postgresql/9.1/main ~/postgresql/lib/new-install 

 $ rm -rf /var/lib/postgresql/9.1/main 
 $ cp -a ~/postgresql/lib/old-install /var/lib/postgresql/9.1/main 
 $ su postgres -c '/usr/lib/postgresql/9.1/bin/pg_resetxlog \
    -f /var/lib/postgresql/9.1/main' 

I edited /etc/postgresql/9.1/main/postgresql.conf

 $ service postgresql start 

And it worked :-)

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.