metasploit-framework icon indicating copy to clipboard operation
metasploit-framework copied to clipboard

module not found error in msfconsole

Open C4ssif3r opened this issue 2 years ago • 3 comments

Hi rapid7 team ! I have this error when type msfconsole in my terminal... Error :

rake aborted!
NoMethodError: undefined method `>' for nil:NilClass
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:55:in `each'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:55:in `block in require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:44:in `each'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:44:in `require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler.rb:187:in `require'
/usr/share/metasploit-framework/config/application.rb:13:in `<top (required)>'
/usr/share/metasploit-framework/Rakefile:2:in `require'
/usr/share/metasploit-framework/Rakefile:2:in `<top (required)>'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

C4ssif3r avatar Oct 17 '22 02:10 C4ssif3r

module not found error in msfconsole

Where does the "module not found" error come from? This message is not shown in the stack trace.

bcoles avatar Oct 17 '22 02:10 bcoles

It looks like there's not enough information to replicate this issue. Please provide any relevant output and logs which may be useful in diagnosing the issue.

This includes:

  • All of the item points within this template
  • The result of the debug command in your Metasploit console
  • Screenshots showing the issues you're having
  • Exact replication steps

The easier it is for us to replicate and debug an issue means there's a higher chance of this issue being resolved.

github-actions[bot] avatar Oct 17 '22 21:10 github-actions[bot]

I am seeing this very same error in the latest Kali Linux trying to initialize the db. To replicate : msfdb reinit as root.

┌──(kwyxz㉿kali)-[~]
└─$ sudo msfdb reinit        
[i] Database already started
[+] Dropping databases 'msf'
[+] Dropping databases 'msf_test'
[+] Dropping database user 'msf'
[+] Deleting configuration file /usr/share/metasploit-framework/config/database.yml
[+] Stopping database
[+] Starting database
[+] Creating database user 'msf'
[+] Creating databases 'msf'
[+] Creating databases 'msf_test'
[+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
[+] Creating initial database schema
rake aborted!
NoMethodError: undefined method `>' for nil:NilClass
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:35:in `require'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/zeitwerk-2.6.1/lib/zeitwerk/kernel.rb:35:in `require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:55:in `each'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:55:in `block in require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:44:in `each'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler/runtime.rb:44:in `require'
/usr/share/rubygems-integration/all/gems/bundler-2.3.15/lib/bundler.rb:187:in `require'
/usr/share/metasploit-framework/config/application.rb:13:in `<top (required)>'
/usr/share/metasploit-framework/Rakefile:2:in `require'
/usr/share/metasploit-framework/Rakefile:2:in `<top (required)>'
/usr/share/metasploit-framework/vendor/bundle/ruby/3.0.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)

kwyxz avatar Oct 18 '22 21:10 kwyxz

Hi!

This issue has been left open with no activity for a while now.

We get a lot of issues, so we currently close issues after 60 days of inactivity. It’s been at least 30 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request.

github-actions[bot] avatar Nov 18 '22 15:11 github-actions[bot]

Not seeing any issues on this on my Ubuntu install, is this still occurring with latest release?

~/git/metasploit-framework │master *1 ?16> ./msfdb reinit
[?] Would you like to reinit the webservice? (Not Required) [no]: 
[?] Would you like to delete your existing data and configurations? []: 
Please answer yes or no.
[?] Would you like to delete your existing data and configurations? []: no
Clearing http web data service credentials in msfconsole
Running the 'reinit' command for the database:
MSF web service is no longer running
Existing database found, attempting to start it
Starting database at /home/gwillcox/.msf4/db...success
~/git/metasploit-framework │master *1 ?16 >

gwillcox-r7 avatar Dec 13 '22 16:12 gwillcox-r7

Huh thats odd, so just downloaded a fresh install of Kali Linux Weekly rollout and tried replicating this, but was unable to:

┌──(kali㉿kali)-[~]
└─$ msfupdate
msfupdate is no longer supported when Metasploit is part of the operating
system. Please use 'apt update; apt install metasploit-framework'
                                                                             
┌──(kali㉿kali)-[~]
└─$ apt update; apt install metasploit-framework
Reading package lists... Done
E: List directory /var/lib/apt/lists/partial is missing. - Acquire (13: Permission denied)
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
                                                                             
┌──(kali㉿kali)-[~]
└─$ sudo apt update; sudo apt install metasploit-framework
[sudo] password for kali: 
Get:1 http://mirrors.jevincanders.net/kali kali-rolling InRelease [30.6 kB]
Get:2 http://mirrors.jevincanders.net/kali kali-rolling/main amd64 Packages [18.9 MB]
Get:3 http://mirrors.jevincanders.net/kali kali-rolling/main amd64 Contents (deb) [43.6 MB]
Get:4 http://mirrors.jevincanders.net/kali kali-rolling/contrib amd64 Packages [113 kB]
Get:5 http://mirrors.jevincanders.net/kali kali-rolling/contrib amd64 Contents (deb) [167 kB]
Get:6 http://mirrors.jevincanders.net/kali kali-rolling/non-free amd64 Packages [239 kB]
Get:7 http://mirrors.jevincanders.net/kali kali-rolling/non-free amd64 Contents (deb) [906 kB]
Fetched 64.0 MB in 23s (2,731 kB/s)                                         
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
74 packages can be upgraded. Run 'apt list --upgradable' to see them.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  clamav clamav-daemon
The following packages will be upgraded:
  metasploit-framework
1 upgraded, 0 newly installed, 0 to remove and 73 not upgraded.
Need to get 153 MB of archives.
After this operation, 7,192 kB of additional disk space will be used.
Get:1 http://mirrors.jevincanders.net/kali kali-rolling/main amd64 metasploit-framework amd64 6.2.30-0kali1 [153 MB]
Fetched 153 MB in 9s (17.8 MB/s)                                            
(Reading database ... 396465 files and directories currently installed.)
Preparing to unpack .../metasploit-framework_6.2.30-0kali1_amd64.deb ...
Unpacking metasploit-framework (6.2.30-0kali1) over (6.2.29-0kali1) ...
Setting up metasploit-framework (6.2.30-0kali1) ...
Processing triggers for kali-menu (2022.4.1) ...
Processing triggers for man-db (2.11.1-1) ...
                                                                             
┌──(kali㉿kali)-[~]
└─$ msfdb     

Manage the metasploit framework database

You can use an specific port number for the
PostgreSQL connection setting the PGPORT variable
in the current shell.

Example: PGPORT=5433 msfdb init

  msfdb init     # start and initialize the database
  msfdb reinit   # delete and reinitialize the database
  msfdb delete   # delete database and stop using it
  msfdb start    # start the database
  msfdb stop     # stop the database
  msfdb status   # check service status
  msfdb run      # start the database and run msfconsole

                                                                             
┌──(kali㉿kali)-[~]
└─$ msfdb init
[-] Error: /usr/bin/msfdb must be run as root
                                                                             
┌──(kali㉿kali)-[~]
└─$ 
                                                                             
┌──(kali㉿kali)-[~]
└─$ sudo msfdb reinit
[+] Starting database
[+] Deleting configuration file /usr/share/metasploit-framework/config/database.yml
[+] Stopping database
[+] Starting database
[+] Creating database user 'msf'
[+] Creating databases 'msf'
[+] Creating databases 'msf_test'
[+] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
[+] Creating initial database schema
                                                                             
┌──(kali㉿kali)-[~]
└─$

This is potentially an issue with your local machine. Given I don't have further information to replicate this issue I'm going to go ahead and close this until such time that sufficient information can be provided to replicate this.

gwillcox-r7 avatar Dec 14 '22 14:12 gwillcox-r7