Results 1 to 2 of 2

Thread: Metasploit LoadError cannot load such file

  1. #1

    Angry Metasploit LoadError cannot load such file

    Hey guys sorry I haven't posted on here as much as of late but wondering if anyone else is having the same problem.

    After installing metasploit via
    Code:
    apt-get install metasploit
    After doing:
    Code:
    service postgresql start
    service metasploit start
    msfconsole
    Here is the error after the databases are build:
    Code:
    [*] Starting the Metasploit Framework console...[-] WARNING! The following modules could not be loaded!
    -[-] 	/usr/share/metasploit-framework/modules/payloads/stages/windows/x64/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/stages/windows/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    |[-] 	/usr/share/metasploit-framework/modules/payloads/stages/windows/patchupmeterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/stages/java/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/stages/linux/x86/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    /[-] 	/usr/share/metasploit-framework/modules/payloads/stages/android/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/stages/python/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    -[-] 	/usr/share/metasploit-framework/modules/payloads/stages/php/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/metsvc_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    \[-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_https.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    |[-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_http.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_ipv6_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    /[-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_https.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    -[-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_http.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_ipv6_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    \[-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    |[-] 	/usr/share/metasploit-framework/modules/payloads/singles/windows/metsvc_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/bsd/x86/metsvc_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    /[-] 	/usr/share/metasploit-framework/modules/payloads/singles/bsd/x86/metsvc_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    [-] 	/usr/share/metasploit-framework/modules/payloads/singles/linux/x86/metsvc_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    -[-] 	/usr/share/metasploit-framework/modules/payloads/singles/linux/x86/metsvc_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    \[-] 	/usr/share/metasploit-framework/modules/payloads/singles/php/meterpreter_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    As a troubleshooting step I did this:
    Code:
    cd /usr/share/metasploit-framework/modules/
    chmod -R 777 payloads/
    ls -l
    drwxr-xr-x 20 root root 4096 May 11 19:03 auxiliary
    drwxr-xr-x 11 root root 4096 May 11 19:03 encoders
    drwxr-xr-x 18 root root 4096 May 11 19:03 exploits
    drwxr-xr-x  9 root root 4096 May 11 19:03 nops
    drwxrwxrwx  5 root root 4096 May 11 20:55 payloads
    drwxr-xr-x 10 root root 4096 May 11 19:03 post
    However still get same error as presented in the beginning so it's not premissions heard about openssl-ruby being an issue but this is the newest version.

    I'm suspecting it has something to do this:
    Code:
    cd /usr/share/metasploit-framework/modules/payloads/stagers/windows/x64
    ruby bind_tcp.rb
    /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- msf/core (LoadError)
    	from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    	from bind_tcp.rb:7:in `<main>'
    This seems to yield interesting results when looking into this particular error I tried a few gem installs but with no avail.
    I know this has nothing to do with the database

    Is anyone else having this problem with their Raspberry Pi or Raspberry Pi 2?

    I've also tried the following:
    Code:
    reload_all
    db_rebuild_cache
    The database builds fine but the reload_all causes the same error it must have to do with ruby or the modules folder

    Any help would certainly be appreciated I'm certainly stumped at this point.

    Cheers!

    -lillypad

  2. #2
    I think I've solved the problem after a few days. The reason is not the image, it is an issue with the actual Metasploit repositories from Offensive Security. If you do a simple `apt-get install metasploit` the issue will present itself right away giving you these errors.

    Code:
    [*] Starting the Metasploit Framework console...[-] WARNING! The following modules could not be loaded!
    -[-]    /usr/share/metasploit-framework/modules/payloads/stages/windows/x64/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/stages/windows/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    |[-]    /usr/share/metasploit-framework/modules/payloads/stages/windows/patchupmeterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/stages/java/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/stages/linux/x86/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    /[-]    /usr/share/metasploit-framework/modules/payloads/stages/android/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/stages/python/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-]    /usr/share/metasploit-framework/modules/payloads/stages/php/meterpreter.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/windows/metsvc_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    \[-]    /usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_https.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    |[-]    /usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_http.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_reverse_ipv6_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    /[-]    /usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_https.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    -[-]    /usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_http.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_reverse_ipv6_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    \[-]    /usr/share/metasploit-framework/modules/payloads/singles/windows/x64/meterpreter_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/windows/meterpreter_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    |[-]    /usr/share/metasploit-framework/modules/payloads/singles/windows/metsvc_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/bsd/x86/metsvc_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    /[-]    /usr/share/metasploit-framework/modules/payloads/singles/bsd/x86/metsvc_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    [-]     /usr/share/metasploit-framework/modules/payloads/singles/linux/x86/metsvc_bind_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    -[-]    /usr/share/metasploit-framework/modules/payloads/singles/linux/x86/metsvc_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    \[-]    /usr/share/metasploit-framework/modules/payloads/singles/php/meterpreter_reverse_tcp.rb: LoadError cannot load such file -- metasploit-payloads
    And on top of this if you install Metasploit from the meta-packages like `apt-get install kali-linux-top10` you are not able to get Metasploit installed as a service under `/etc/init.d/metasploit`. I've went as far as copying over the service script from another box of mine but this will not work I can assure you of that. The repositories have somehow mangled the services portion of the package causing issues with the payload modules and ruby. I did however find a ridiculous and hopefully temporary way around this issue.

    Install fresh image of kali-1.1.0-rpi.img:

    Code:
    wget http://images.offensive-security.com/ARM/kali-1.1.0-rpi2.img.xz
    Uncompress the file:

    Code:
    xz -D kali-1.1.0-rpi2.img.xz
    Move the image to your SD Card:

    Code:
    dd if=kali-1.0.9-rpi.img of=/dev/sdb bs=512k
    After this I would recommend installing GParted on your host machine:

    Code:
    apt-get install gparted
    After opening GParted and select your device and un-mount main partition:
    1.jpg


    Now we will resize the main partition to the most storage space:
    2.jpg


    Now drag to fit your needs:
    3.jpg


    Now apply the changes:
    4.jpg


    Wait for process to complete or you will lose your data

    Now connect the HDMI, USB Mouse, USB Keyboard and ethernet or Wifi Adapter.

    After that boot up and login as username: root password toor

    Update your password when logging in with the command `passwd` it will ask you to enter a new unix password and to confirm it

    Now type `startx` and you will boot into the GUI

    Complete the Following:

    Code:
    apt-get update
    apt-get upgrade
    apt-get dist-upgrade
    apt-get install kali-linux-top10
    After the install is complete notice that `service metasploit start` will not work and most people reading around the Kali Linux forums will fix this by doing `apt-get install metasploit`. This fatal mistake of doing the install of Metasploit again will cause the error with the payloads module. It would appear it has absolutely nothing with Ruby or Metasploit it's the package that available right now that is broken. Do not do a `apt-get install metasploit` unless you are certain that it will not mess up your existing version.

    There is a simple solution to getting the database connected and running again though by doing the following after doing the `apt-get install kali-linux-top10`

    Code:
    sudo -s
    su postgres
    createuser msf -P -S -R -D
    createdb -O msf msf
    exit
    exit
    Now what we have done is created the database msf with the username as msf and the password as msf and we can connect Metasploit to it manually by doing the following:

    Code:
    service postgresql start
    msfconsole
    db_connect msf:msf@localhost:5432/msf
    After doing the `db_connect` command above I suggest go get a coffee and wait an hour or so for it to complete before doing `exit`.

    Now whenever you want to do a fast search just do the same commands above start the postgresql service start msfconsole and connect to the database manually.

    I'll probably report this bug in the Kali Linux for Raspberry Pi 2 Bug Tracker and see if we can get it fixed. A fix for this should happen faster than putting out another image as it's a problem with the repositories.

    Hope this helps someone out there because it's hard to use your Raspberry Pi 2 for penetration testing especially if your repositories are all messed up. This has been more of a headache than anything but I'm sure the Offensive Security team on the project will update it soon. So for now keep in mind to stick with the meta-packages to install metasploit instead and don't try to fix it with `apt-get install metasploit` or it will ruin your day.

    If you are really worried you might do the `apt-get install metasploit` by mistake you can try this:

    Code:
    apt-mark hold metasploit
    And if you want to upgrade it at some point and you are sure what you're doing:

    Code:
    apt-mark unhold metasploit
    I hope this helps a few people out there.
    Last edited by lillypad; 2015-05-15 at 16:40.

Similar Threads

  1. cant load ruby modules in metasploit
    By cryptoacid in forum TroubleShooting Archive
    Replies: 0
    Last Post: 2020-02-29, 22:20
  2. metasploit.service failed to load: No such file or directory!
    By XtremeLv in forum TroubleShooting Archive
    Replies: 1
    Last Post: 2015-12-20, 21:38
  3. Replies: 0
    Last Post: 2015-10-02, 05:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •