msf fails to connect to db
I'm getting this error when starting the msfconsole
Code:
root@bt:~# msfconsole
[-] ***
[-] *
[-] * Metasploit now requires version 0.11 or higher of the 'pg' gem for database support
[-] * There a three ways to accomplish this upgrade:
[-] * 1. If you run Metasploit with your system ruby, simply upgrade the gem:
[-] * $ rvmsudo gem install pg
[-] * 2. Use the Community Edition web interface to apply a Software Update
[-] * 3. Uninstall, download the latest version, and reinstall Metasploit
[-] *
[-] ***
[-]
[-]
[-] Failed to connect to the database: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (RubyGem version error: pg(0.9.0 not ~> 0.11)
) {"adapter"=>"postgresql", "database"=>"msf3", "username"=>"msf3", "password"=>"cc714249", "host"=>"127.0.0.1", "port"=>7175, "pool"=>75, "timeout"=>5} ["/opt/framework/ruby/lib/ruby/1.9.1/rubygems.rb:751:in `report_activate_error'", "/opt/framework/ruby/lib/ruby/1.9.1/rubygems.rb:214:in `activate'", "/opt/framework/ruby/lib/ruby/1.9.1/rubygems.rb:1054:in `gem'", "/opt/framework/msf3/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/postgresql_adapter.rb:7:in `<top (required)>'", "/opt/framework/msf3/lib/fastlib.rb:374:in `require'", "/opt/framework/msf3/lib/fastlib.rb:374:in `require'", "/opt/framework/msf3/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `block in require'", "/opt/framework/msf3/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:236:in `load_dependency'", "/opt/framework/msf3/lib/gemcache/ruby/1.9.1/gems/activesupport-3.2.8/lib/active_support/dependencies.rb:251:in `require'", "/opt/framework/msf3/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:50:in `resolve_hash_connection'", "/opt/framework/msf3/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:29:in `spec'", "/opt/framework/msf3/lib/gemcache/ruby/1.9.1/gems/activerecord-3.2.8/lib/active_record/connection_adapters/abstract/connection_specification.rb:129:in `establish_connection'", "/opt/framework/msf3/lib/msf/core/db_manager.rb:208:in `connect'", "/opt/framework/msf3/lib/msf/ui/console/driver.rb:195:in `initialize'", "/opt/framework/msf3/msfconsole:148:in `new'", "/opt/framework/msf3/msfconsole:148:in `<main>'"]
I installed the postgresql adapter
Code:
root@bt:~# gem install activerecord-postgresql-adapter
Successfully installed activerecord-postgresql-adapter-0.0.1
1 gem installed
Installing ri documentation for activerecord-postgresql-adapter-0.0.1...
Installing RDoc documentation for activerecord-postgresql-adapter-0.0.1...
Also the pg
Code:
root@bt:~# gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.14.1
1 gem installed
Installing ri documentation for pg-0.14.1...
Installing RDoc documentation for pg-0.14.1...
Reinstalled postgresql
Code:
root@bt:~# apt-get install postgresql
Reading package lists... Done
Building dependency tree
Reading state information... Done
postgresql is already the newest version.
The following packages were automatically installed and are no longer required:
ettercap
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 24 not upgraded.
And after all this, I still get the same error above.
What should I do next?
Re: msf fails to connect to db
I fail to encounter this issue:
Code:
root@bt:~# msfconsole
, ,
/ \
((__---,,,---__))
(_) O O (_)_________
\ _ / |\
o_o \ M S F | \
\ _____ | *
||| WW|||
||| |||
=[ metasploit v4.5.0-dev [core:4.5 api:1.0]
+ -- --=[ 991 exploits - 560 auxiliary - 163 post
+ -- --=[ 262 payloads - 28 encoders - 8 nops
msf >
Metasploit uses it's own postgresql database so chances are you may have broken something. I would suggest you join their IRC channel and look for help.
Also reinstalling msf might solve the problems.
Re: msf fails to connect to db
Originally I had a problem with Armitage after an msfupdate.
After several hours of running through every option available I had to purge msf.
Re-installed it and then this was the issue:
Failed to connect to the database: Please install the postgresql adapter: `gem install activerecord-postgresql-adapter`
I thought I took care of it but it keeps coming up.
Have I miss something?... I don't have a clue as to what to try next.
Thanks for replying.
Re: msf fails to connect to db
Try completely removing metasploit and download a fresh copy from their official website, see if that works for you.
Re: msf fails to connect to db
I've seen people reinstalling msf due to update...All came out just fine after re- installation..So do as sickness says...
Re: msf fails to connect to db
So after several hours of downloading and re-installing, I've decided to move to a new VM.
I'm keeping the old one to eventually learn from it as I progress.
Thanks a lot for your answers guys.
Re: msf fails to connect to db
If I were you , I would dual boot..
But it's up to you...It's your call.
Luck.