rapid7 / metasploit-framework

Metasploit Framework
https://www.metasploit.com/
Other
34.1k stars 13.96k forks source link

WARNING: No database support: No database YAML file #11250

Closed ratrapist closed 5 years ago

ratrapist commented 5 years ago

Steps to reproduce

How'd you do it?

  1. Did a clean install of kali linux 2018.4 on hyper-v.

  2. get-apt update && apt-get dist upgrade

  3. Opened up msfconsole and saw I was running msf 4

  4. Ran this command curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \ chmod 755 msfinstall && \ ./msfinstall

  5. Opened msfconolse and got

-] **rting the Metasploit Framework console...| [-] WARNING: No database support: No database YAML file

starting postgresql service works fine

Expected behavior

msf should connect to the database

Current behavior

I get an error about "No database YAML file"

System stuff

Metasploit version

metasploit 5

I installed Metasploit with:

curl https://raw.githubusercontent.com/rapid7/metasploit-omnibus/master/config/templates/metasploit-framework-wrappers/msfupdate.erb > msfinstall && \ chmod 755 msfinstall && \ ./msfinstall

OS

Kali Linux 2018.4

ratrapist commented 5 years ago

I got this fixed by closing my terminal and clicking the metasploit-framework icon on the sidebar in kali linux, it then opened a new terminal that created the database file for me. It failed to open msfconsole, but now when I type msfconsole in terminal it opens up no problem

krupalb commented 5 years ago

why wouldn't the command line msfconsole doesn't do the same thing?

Anutrix commented 5 years ago

Can't click icon because there's no GUI in kali-linux WSL. Any other fix?

CybernetiX-S3C commented 5 years ago

The fix is the same for all versions of MSF.

/etc/init.d/postgresql

service --status-all service postgresql start service postgresql status

/usr/bin/msfconsole

msfdb init msfconsole msf > db_status

fillipehmeireles commented 5 years ago

"msfconsole-start" worked for me on terminal

thel0ner commented 5 years ago

@CybernetiX-S3C 's solution did the trick 4 meh ;P

amantiwari8861 commented 5 years ago

I have downloaded metasploit-framework software in .exe and running on windows 10 After running it's showing

warning: no database support : no database yaml file

What can i do pls help me

ghost commented 5 years ago

@CybernetiX-S3C thumpsuP

RohmatRomadhon commented 5 years ago

where the answer >(

THEpWn3R-o commented 5 years ago

I did this, running the newest version of Ubuntu in the home directory, it will also make it easier if you have **show hidden files** on in the file viewer to interact with the **.msf4** folder, because it is hidden chmod 777 .msf4 cd .msf4

then i minimized the terminal, made a blank document in leafpad, named it database.yml put it in the home folder, put it in .msf4 then go back into the terminal (in the .msf4 directory) and ran msfdb init it will ask if you want to delete old configs, type "y" then it should make a new database.yml that is correct and working.

ghost commented 4 years ago

Running msfconsole-start worked for me.

Whiteshadow-hacker commented 4 years ago

guys, i have a solution for this problem : open your terminal and type: msfdb init this would surely work

shad0wcrawl3r commented 4 years ago

guys, i have a solution for this problem : open your terminal and type: msfdb init this would surely work

Did not work. db_status returns: [*] postgresql selected, no connection

THEpWn3R-o commented 4 years ago

After using the fix that I posted above ^^ Type: service postgresql start Then type: msfconsole Root is optional

Amal-p commented 4 years ago

when msfconsole oppen it show WARNING:No database support:No database YAML file

Muhd-Mubi commented 4 years ago

sudo msfdb init or if you have already done it before sudo msfdb reinit should solve it

hackdefendr commented 4 years ago

What happens if you try all the things mentioned and still I get the same error?

Postgres is running. I did the msfdb init. I get an error saying the port is already in use.

I think there is an actual bug here and it seems that msfconsole is not recognizing where the database.yml file is located. Under plain old Debian, that file is located /var/lib/postgresql/.msf4/database.yml, but msfconsole is searching /opt/metasploit-framework/embedded/framework/config/.

bcoles commented 4 years ago

What happens if you try all the things mentioned and still I get the same error? I get an error saying the port is already in use.

@hackdefendr Perhaps the port is already in use?

Also, please don't post on closed issue. That's not the same error.

Also, please provide evidence, such as logs.

hackdefendr commented 4 years ago

So all those other people from 13 days ago commenting is OK, but when I do it, it's a problem. It is the same issue, same error. I added the port in use because I saw that too.

bcoles commented 4 years ago

You seem upset. This always chears me up:

https://www.youtube.com/watch?v=yZNtYmdZ-4c

hackdefendr commented 4 years ago

Why do people always say that when I comment? I simply pointed out that you didn't say anything to anyone else's comments.

Anyway I fixed my own problem by copying the database.yml file to a location that metasploit recognizes. Which is a bug in my opinion, since msfdb creates the yml file, then msfconsole should be able to find it.

bcoles commented 4 years ago

Cool, glad you got it sorted.

Bug reports are always appreciated. There might be a bug here, but without logs it is impossible to known. Now that you've edited your post to provide additional details it might be easier for someone to investigate. And if it's not a bug, maybe the user experience workflow could be improved.

In this instance the initial post lacked details and appeared to be referencing a different issue related to a port. The reason we ask people to post new issues for new issues is because this increases visibility and encourages completing the issue template, which includes useful information such as the version of metasploit, the method used to install metasploit, and logs.

Tagging @acammack-r7 as I think he's the database guy and may want to take a look.

hackdefendr commented 4 years ago

Groovy. I can easily open a new issue and reproduce the issue to gather logs n such.

macxpedia commented 4 years ago

We all have solved this issue together. Let me just give a quick summary
1.Start postgresql service (MSF use this service and dependence you can install it other OS if not kali) service postgresql status (If no result option 2)

Option 2: msfdb init ( Follow the proceedings till you create your msfdb) msfdb start Database already started at /home....... run msfconsole

If still having issues you can follow what
hackdefendr commented Mar 20, 2020

He fixed his own problem by copying the database.yml file to a location that metasploit recognizes. Which is a bug in my opinion, since msfdb creates the yml file, then msfconsole should be able to find it.

Option 1 & 2 solves this issues most of the time if there is no Bug

Amal-p commented 4 years ago

When using -x ther is an error eg :msfvenom -x /root/Desktop/mini.apk -p android/meterpreter/reverse_tcp LHOST= LPORT=444 -o /root/Desktop/minimiltia.apk

Using APK template: /root/Desktop/mini.apk [-] No platform was selected, choosing Msf::Module::Platform::Android form the payload [-]No arch selectod, selecting arch: dalvik from the payload Error: Malformed version number string 2.4.0-dirty Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true

On Sun, 22 Mar 2020, 6:03 pm macxpedia, notifications@github.com wrote:

We all have solved this issue together. Let me just give a quick summary 1.Start postgresql service (MSF use this service and dependence you can install it other OS if not kali) service postgresql status (If no result option 2)

Option 2: msfdb init ( Follow the proceedings till you create your msfdb) msfdb start Database already started at /home....... run msfconsole

If still having issues you can follow what hackdefendr commented Mar 20, 2020

He fixed his own problem by copying the database.yml file to a location that metasploit recognizes. Which is a bug in my opinion, since msfdb creates the yml file, then msfconsole should be able to find it.

Option 1 & 2 solves this issues most of the time if there is no Bug

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rapid7/metasploit-framework/issues/11250#issuecomment-602192917, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMLL2THA2JQIPILPHTARQODRIYAR5ANCNFSM4GPYBTCA .

amantiwari8861 commented 2 years ago

I have downloaded metasploit-framework software in .exe and running on windows 10 After running it's showing

warning: no database support : no database yaml file

What can i do pls help me

thanks for reply

CybernetiX-S3C commented 2 years ago

The fix is the same for all versions of MSF.

/etc/init.d/postgresql

service --status-all service postgresql start service postgresql status

/usr/bin/msfconsole

msfdb init msfconsole msf > db_status

Still remains the official fix. I continue to use this fix even many hundreds of upgrades later.

leoalbano commented 1 year ago

Estoy tratando de usar Metasploit en Pentest Box, pero me da exactamente el mismo error. Agradecería cualquier ayuda.

gwillcox-r7 commented 1 year ago

This is getting offtopic and people have solved this issue by using the fix noted at https://github.com/rapid7/metasploit-framework/issues/11250#issuecomment-602192917. If you have a legitimate issue please raise a new bug and add this bug as a reference in the description. Commenting on an issue that is already resolved just leads to confusion and headache for everyone involved. Its better to raise a new issue, verify that it replicates on the latest code (we update our code frequently so its possible that something may have been fixed), and after that we can reopen associated issues as needed, particularly if you link them in your issue description and we then determine that they are relevant.