Metasploit on FreeBSD ("no database driver installed")

Is there anyone here that successfully uses security/metasploit on FreeBSD?
The port installs and runs, and also postgresql is running. But metasploit just doesn't connect to the database. When running msfconsole I get:

Code:
root@yokozuna:~ # msfconsole
                                                  
     ,           ,
    /             \
   ((__---,,,---__))
      (_) O O (_)_________
         \ _ /            |\
          o_o \   M S F   | \
               \   _____  |  *
                |||   WW|||
                |||     |||


       =[ metasploit v4.16.57-dev                         ]
+ -- --=[ 1767 exploits - 1005 auxiliary - 307 post       ]
+ -- --=[ 537 payloads - 41 encoders - 10 nops            ]
+ -- --=[ Free Metasploit Pro trial: http://r-7.co/trymsp ]

[4mmsf[0m [0m>

But metasploit doesn't connect to a database:
Code:
[4mmsf[0m [0m> db_status
[-] No database driver installed. Try 'gem install pg'

The suggested gem install pg doesn't work either:
Code:
[4mmsf[0m [0m> gem install pg
[*] exec: gem install pg

Building native extensions. This could take a while...
ERROR:  Error installing pg:
        ERROR: Failed to build gem native extension.

    current directory: /usr/local/lib/ruby/gems/2.4/gems/pg-1.0.0/ext
/usr/local/bin/ruby24 -r ./siteconf20180602-31634-1qgflo4.rb extconf.rb
/usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find pg-1.0.0 in any of the sources (Bundler::GemNotFound)
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/spec_set.rb:85:in `map!'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/spec_set.rb:85:in `materialize'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/definition.rb:171:in `specs'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/definition.rb:238:in `specs_for'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/definition.rb:227:in `requested_specs'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/runtime.rb:108:in `block in definition_method'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/runtime.rb:20:in `setup'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler.rb:107:in `setup'
        from /usr/local/lib/ruby/gems/2.4/gems/bundler-1.16.2/lib/bundler/setup.rb:20:in `<top (required)>'
        from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /usr/local/lib/ruby/site_ruby/2.4/rubygems/core_ext/kernel_require.rb:59:in `require'

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.4/gems/pg-1.0.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4/extensions/amd64-freebsd-11/2.4/pg-1.0.0/gem_make.out

So does anyone know what to do to use metasploit in FreeBSD?
 
Never used metasploit on FreeBSD perhaps try using pkgng

Code:
pkg install rubygem-pg-1.0.0

A quick online ports search shows a few pg versions and other related PostgreSQL/ruby packages when searching for "PostgreSQL" may want to go through them to see if anything works.

Good luck!
 
I never worked with metasploit (on FreeBSD). But I tried it now.
I got another error:
Code:
Failed to connect to the database: ActiveRecord::ConnectionNotEstablished
I did not got the "No database driver installed" error.
I am not sure, but I think both my error and the error above could be a config-error.

Could someone post the configure steps for metasploit? (maybe, I overlooked something).

Edit:
Seems it was an error in .msf4/database.yml.
Now I got the same error.
 
I am playing with metasploit again and saw this old post. Solved it so thought I post this follow-up.
The database connection problem is due to the metasploit database not being initialized. A msfdb init or msfdb reinit (as user) solved this.
Other needed command is bundle install (as root) in the /usr/local/share/metasploit directory, to install needed gems.
 
I can run

$ msfdb start
$ msfconsole

I still get the "no database support" error.

Typing 'db_status' from the console returns 'No database driver installed.'
 
Thats what 'msfdb start' does.

The PKG doesn't install postgresql11 - server. I had to install that manually - which fixed the msfdb init error.

msfconsole does not see the postgresql service started by msfdb.
 
Back
Top