Thanks to Code Friendly
, & I want to share how I solved my problem.
When I updated postgresql
from the Synaptic application, it is the postgresql 10 version that was installed. So I had two versions of postgresql (10 & 9.6) installed in my debian machine. Postgresql 9.6
listening on port 5432
. Postgresql 10
listening on port 5433
instead of 5432.
When I run the comand msfconsole
in a terminal, although metasploit connects to the msf database on port 5432, the following error message appears:
root@kali:~# msfconsole
[-] Failed to connect to the database: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?
I unistall the 9.6 postgresql version from the Synaptic application, but the problem persists (postgresql 9.6 no longer appears in synaptic's installed software list);
But by executing the command that follows we see that the version postgresql 9.6 was not completely unistalled:
root@kali:~# dpkg -l | grep postgresql
ii postgresql 10+187 all object-relational SQL database (supported version)
ii postgresql-9.6 ** all object-relational SQL database, version 9.6 server
ii postgresql-10 10.0-1+b1 amd64 object-relational SQL database, version 10 server
ii postgresql-client-10 10.0-1+b1 amd64 front-end programs for PostgreSQL 10
ii postgresql-client-common 187 all manager for multiple PostgreSQL client versions
ii postgresql-common 187 all PostgreSQL database cluster manager
ii postgresql-contrib 10+187 all additional facilities for PostgreSQL (supported version)
With the following command, postgresql-9.6 uninstalled completely:
root@kali:~# sudo apt-get --purge remove postgresql-9.6
Then I edited the file /etc/postgresql/10/main/postgresql.conf
, changed the port number to 5432 and the problem is solved.
Another error message appears:
Creating initial database schema /usr/local/bin/bundle:22:in ``load': cannot load such file -- /usr/lib/ruby/exe/bundle (LoadError) from /usr/local/bin/bundle:22:in `<main>
I found that the cause was that two (2) versions of Ruby are installed in my debian machine, versions (2.2 & 2.3).
Same thing, I uninstall the ruby 2.2 version from the synaptic application and the problem is solved, metasploit starts without problems.