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.

1 Answer 1


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 :-)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .