Metasploit-framework: Can't run msfconsole because of ruby dependencies

Created on 7 Apr 2018  Â·  9Comments  Â·  Source: rapid7/metasploit-framework

Steps to reproduce

How'd you do it?
Everything started when I ran msfconsole and got the first error:

Traceback (most recent call last):
1: from :2:in <internal:gem_prelude>' <internal:gem_prelude>:2:inrequire': cannot load such file -- rubygems.rb (LoadError)

Then I found on stackoverflow that this error can be caused because of a new version of ruby (which by the way mine standard is: ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]

So, I installed rvm and changed ruby to version 2.3.7 (rvm use 2.3.7)
Now, when I run msfconsole I got:

Could not find rake-12.3.1 in any of the sources
Run bundle install to install missing gems.

and If I run "bundle install":

Could not locate Gemfile

I tried to manually install this rake with gem install rake but the problem persists.

This section should also tell us any relevant information about the
environment; for example, if an exploit that used to work is failing,
tell us the victim operating system and service versions.

Expected behavior

msfconsole to start up

Current behavior

errors described above

You might also want to check the last ~1k lines of
/opt/metasploit/apps/pro/engine/config/logs/framework.log
no such file or directory
or
~/.msf4/logs/framework.log for relevant stack traces:
https://pastebin.com/ftZN7baX

System stuff

Metasploit version

4.16.49-1-x86_64

I installed Metasploit with:

  • [ ] Kali package via apt
  • [ ] Omnibus installer (nightly)
  • [ ] Commercial/Community installer (from http://www.rapid7.com/products/metasploit/download.jsp)
  • [ ] Source install (please specify ruby version)
  • [x] BlackArch installed on top of ArchLinux OS

OS

ArchLinux

Most helpful comment

Looks like blackarch installs under /opt/metasploit

Try gem install bundler; bundle while in that directory. That's about as much as I can help attthe moment.

All 9 comments

That would be a BlackArch issue, since we don't control how that distro packages Metasploit. Not much we can do about it here. Sorry.

I'll give it a quick install and if it's possible to see where the package goes wrong, I'll try to leave them a note. It might be easier in the mean time for you to just check out from git.

Looks like blackarch installs under /opt/metasploit

Try gem install bundler; bundle while in that directory. That's about as much as I can help attthe moment.

running it inside metasploit directory solved the problem, thanks m8

@busterb

I have same issued in here

When i run msfconsole it show error :

[email protected]:~#msfconsole WARNING: linker: /data/data/com.termux/files/usr/lib/ruby/gems/2.5.0/gems/psych-3.0.3/lib/psych.so: unused DT entry: type 0x6ffffef5 arg 0x4d0 Could not find nokogiri-1.8.0 in any of the sources
Run bundle install to install missing gems.

And when i run bundle install result says :

[email protected]:~#bundle install WARNING: linker: Unsupported flags DT_FLAGS_1=0x8 WARNING: linker: Unsupported flags DT_FLAGS_1=0x8
Could not locate Gemfile

I try to following your command and the result says :

[email protected]:~#gem install bundler; bundle
WARNING: linker: /data/data/com.termux/files/usr/lib/ruby/gems/2.5.0/gems/psych-3.0.3/lib/psych.so: unused DT entry: type 0x6ffffef5 arg 0x4d0 Successfully installed bundler-1.17.1 Parsing documentation for bundler-1.17.1
Done installing documentation for bundler after 28 seconds
1 gem installed
Could not locate Gemfile

Still same error,what should i do?
Help

Termux is not supported. #11023

i can not open msfconsole.....it gives me this error

Traceback (most recent call last):
44: from C:/metasploit-framework/bin/../embedded/framework/msfconsole:48:in <main>' 43: from C:/metasploit-framework/bin/../embedded/framework/msfconsole:48:inrequire'
42: from C:/metasploit-framework/embedded/framework/lib/msf/core/payload_generator.rb:2:in <top (required)>' 41: from C:/metasploit-framework/embedded/framework/lib/msf/core/payload_generator.rb:2:inrequire'
40: from C:/metasploit-framework/embedded/framework/lib/msf/core/payload/apk.rb:3:in <top (required)>' 39: from C:/metasploit-framework/embedded/framework/lib/msf/core/payload/apk.rb:3:inrequire'
38: from C:/metasploit-framework/embedded/framework/lib/msf/core.rb:64:in <top (required)>' 37: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
36: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in load_dependency' 35: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inblock in require'
34: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require' 33: from C:/metasploit-framework/embedded/framework/lib/msf/core/auxiliary.rb:4:in 32: from C:/metasploit-framework/embedded/framework/lib/msf/core/auxiliary.rb:14:in <module:Msf>' 31: from C:/metasploit-framework/embedded/framework/lib/msf/core/auxiliary.rb:16:in'
30: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require' 29: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:inload_dependency'
28: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in block in require' 27: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
26: from C:/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/mixins.rb:28:in <top (required)>' 25: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
24: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in load_dependency' 23: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inblock in require'
22: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require' 21: from C:/metasploit-framework/embedded/framework/lib/msf/core/auxiliary/mqtt.rb:3:in 20: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require' 19: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:inload_dependency'
18: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in block in require' 17: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
16: from C:/metasploit-framework/embedded/framework/lib/msf/core/exploit.rb:5:in <top (required)>' 15: from C:/metasploit-framework/embedded/framework/lib/msf/core/exploit.rb:30:in'
14: from C:/metasploit-framework/embedded/framework/lib/msf/core/exploit.rb:289:in <class:Exploit>' 13: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
12: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in load_dependency' 11: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inblock in require'
10: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require' 9: from C:/metasploit-framework/embedded/framework/lib/msf/core/exploit/mixins.rb:11:in 8: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in require' 7: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:inload_dependency'
6: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in block in require' 5: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
4: from C:/metasploit-framework/embedded/framework/lib/msf/core/exploit/expect.rb:7:in <top (required)>' 3: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inrequire'
2: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:240:in load_dependency' 1: from C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:inblock in require'
C:/metasploit-framework/embedded/lib/ruby/gems/2.6.0/gems/activesupport-4.2.11.1/lib/active_support/dependencies.rb:274:in `require': cannot load such file -- expect (LoadError)

i'm using Metasploit 5.0.74
i'm using it on windows........
i've tried to update it with msfupdate.......i've tried to reinstall it....
i've tried to delete all registry too but nothing helps.....

try this way bro. fixed for me

i had this problem. and my head explosed before i found solution if u wanrt do like i did follow my steps :

delete all data and cach of termux until the data becom 0 kb (setting. manage applications. termux. stockage. delete data)

re-open termux and write the firsts commands (pkg update. pkg upgrade. pkg install php. pkg install git…… ect.)

now we install the metasploit 5 correctly without any error or problem.

-- pkg install unstable-repo

-- pkg install metasploit

it will take long time. when finishin the installation you can wrute commad "msfconsole" anywhere no need to write in folder of metasploit
now it work correctly

this way worked 100% for me in my phone and in emulator

note : this is the first way for install metasploit if you have the older version inyour phone and you install this it will not work

Locking this thread as this is going off topic quick with people posting about Windows, Termux and Arch all at once, when the original question was from 2 years ago and was related to BlackArch specifically.

Was this page helpful?
0 / 5 - 0 ratings