This morning when searching for a module in Metasploit I received the dreaded error:

Database not connected or cache not built, using slow search

Surprisingly, there was very little information on forums or other blogs regarding this in the context of Kali 2.0 – so I’ll document my fix here.

Further to the above error, entering the command ‘db_status‘ returns:

postgresql selected, no connection

The solution: to create a new database and connect metasploit to it. But first, the postgresql service must be started and set to auto-start:

service postgresql start
update-rc.d postgresql enable

The database can then be created:

su postgres
createuser msf_user –P
(enter password)

createdb –owner=msf_user msf_database

… and Metasploit configured to point to the newly created database:

msfconsole

db_connect msf_user:@127.0.0.1/msf_database

This will automatically initiate a rebuild of the module cache (the equivalent of running update_db_cache).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s