metasploit-framework
metasploit-framework copied to clipboard
using msfdb on windows 11 failed
PS D:\metasploit-framework\bin> .\msfdb.bat reinit --component database --use-defaults
D:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/rex-core-0.1.28/lib/rex/compat.rb:378: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
Overriding user environment variable 'OPENSSL_CONF' to enable legacy functions.
Clearing http web data service credentials in msfconsole
Running the 'reinit' command for the database:
MSF web service is no longer running
Database is no longer running at C:/Users/k_kar/.msf4/db
Deleting all data at C:/Users/k_kar/.msf4/db
Creating database at C:/Users/k_kar/.msf4/db
[!] Attempt to create DB socket file at Temporary Directory and `~/.msf4/db` failed. Possibly because they are mounted with NOEXEC flags. Database initialization failed.
Starting database at C:/Users/k_kar/.msf4/db...
ctrl+c
#<Thread:0x000001e346537750 D:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:471 run> terminated with exception (report_on_exception is true):
D:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:403:in `read': stream closed in another thread (IOError)
from D:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:403:in `block (2 levels) in capture2e'
from D:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/logging-2.3.1/lib/logging/diagnostic_context.rb:474:in `block in create_with_logging_context'
D:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:415:in `value': Interrupt
from D:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:415:in `block in capture2e'
from D:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:227:in `popen_run'
from D:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:209:in `popen2e'
from D:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:398:in `capture2e'
from D:/metasploit-framework/embedded/framework/lib/msfdb_helpers/db_interface.rb:55:in `run_cmd'
from D:/metasploit-framework/embedded/framework/lib/msfdb_helpers/pg_ctl.rb:98:in `start'
from D:/metasploit-framework/embedded/framework/lib/msfdb_helpers/pg_ctl.rb:35:in `init'
from D:/metasploit-framework/bin/../embedded/framework/msfdb:201:in `init_db'
from D:/metasploit-framework/bin/../embedded/framework/msfdb:339:in `reinit_db'
from D:/metasploit-framework/bin/../embedded/framework/msfdb:945:in `invoke_command'
from D:/metasploit-framework/bin/../embedded/framework/msfdb:1086:in `<main>'
Terminate batch job (Y/N)? Y
PS D:\metasploit-framework\bin>
Edition Windows 11 Pro Version 21H2 Installed on 1.10.2022 г. OS build 22000.1165 Experience Windows Feature Experience Pack 1000.22000.1165.0
postgresql 15 latest
Unclear if this stack trace is occurring because you CTRL+C'd in the middle of something, in which case we would expect an error trace to occur.
You output also mentions [!] Attempt to create DB socket file at Temporary Directory and
~/.msf4/db failed. Possibly because they are mounted with NOEXEC flags. Database initialization failed.
which likely means that you might need to update the location where the socket file for PostgreSQL is created as its trying to create it in the wrong location.
You might want to fix this by searching for the postgresql.conf
file and checking if unix_socket_directories
is enabled and what directory it is set to if it is enabled. It may be better to disable this setting if you are on Windows.
Unclear if this stack trace is occurring because you CTRL+C'd in the middle of something, in which case we would expect an error trace to occur.
You output also mentions
[!] Attempt to create DB socket file at Temporary Directory and
~/.msf4/dbfailed. Possibly because they are mounted with NOEXEC flags. Database initialization failed.
which likely means that you might need to update the location where the socket file for PostgreSQL is created as its trying to create it in the wrong location.You might want to fix this by searching for the
postgresql.conf
file and checking ifunix_socket_directories
is enabled and what directory it is set to if it is enabled. It may be better to disable this setting if you are on Windows.
im CTRL+C after the process hangs up on starting database.The real reason is: [!] Attempt to create DB socket file at Temporary Directory and
~/.msf4/db` failed. Possibly because they are mounted with NOEXEC flags. Database initialization failed.
postgresql.conf.txt
This morning`s
PS D:\metasploit-framework\bin> .\msfupdate.ps1
Downloading latest Metasploit Framework
Updating Metasploit Framework
Update Complete
PS D:\metasploit-framework\bin> .\msfdb.bat reinit --component database --use-defaults
D:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/rex-core-0.1.28/lib/rex/compat.rb:378: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
Overriding user environment variable 'OPENSSL_CONF' to enable legacy functions.
Clearing http web data service credentials in msfconsole
Running the 'reinit' command for the database:
MSF web service is no longer running
Database is no longer running at C:/Users/k_kar/.msf4/db
Deleting all data at C:/Users/k_kar/.msf4/db
Creating database at C:/Users/k_kar/.msf4/db
[!] Attempt to create DB socket file at Temporary Directory and ~/.msf4/db
failed. Possibly because they are mounted with NOEXEC flags. Database initialization failed.
Starting database at C:/Users/k_kar/.msf4/db...
and here process hangs up again an have to CTRL+C here unmodified postgresql.conf postgresql.conf.txt
after the last update nothing same error again
This issue is a possible duplicate of #15980. msfdb init
command hangs on windows systems at the line:
Starting database at ...
The warning messages thrown are part of new changes (can be ignored on windows), but the root cause of this bug is still as mentioned in the earlier issue.
so the problem persist after the last update. is it possible to find out more or some solution? i tried to set up permissions nothing again.
Same old story.After update process hangs up again on starting database with posssible reason: [!] Attempt to create DB socket file at Temporary Directory and ~/.msf4/db
failed. Possibly because they are mounted with NOEXEC flags. Database initialization failed.
Starting database at C:/Users/k_kar/.msf4/db...
And here again have to CTRL+C and cannot start database under Windows
@Dinamitrii The issue appears to possibly be related to the msfdb
wrapper script as mentioned by bcoles at https://github.com/rapid7/metasploit-framework/issues/15980#issuecomment-1053338008 as was mentioned by @3V3RYONE.
This has been reproduced by team members and will likely require us updating the script, though at this time it is not yet known what has caused this issue. I'll try set up a target environment today and see if I can't figure out what is going on.
@gwillcox-r7 thank you very much for your time.I`ll be patiently wait for some updates.
Alright I'm currently running into another issue with the Omnibus installers so I can't even get around to testing this one 😢 I'll see if I can't get a issue up for that one so long.
@Dinamitrii So apparently Windows 11 isn't a supported installation target at the moment from what I have been told. Is there any way you could try this with Windows 10 perhaps and see if that helps things?
@gwillcox-r7 ОК Ill try it on OracleVM and if you want I
ll try it on a bare metal OK?
@Dinamitrii Sounds good, appologies for any headache caused by this I also wasn't aware we didn't support Windows 11. VM of Windows 10 should still work but let me know if not and we can dig deeper into this.
@gwillcox-r7 it appers it's more difficult to install on Win 10 than Win 11 after partial install i get to msfupdate.bat i succeeded to install metasploit-framework on Oracle's VM this OS:
Edition Windows 10 Pro Version 22H2 Installed on 11/20/2022 OS build 19045.2311 Experience Windows Feature Experience Pack 120.2212.4190.0
after that same error:
PS C:\metasploit-framework\bin> .\msfdb.bat init
C:/metasploit-framework/embedded/lib/ruby/gems/3.0.0/gems/rex-core-0.1.28/lib/rex/compat.rb:378: warning: Win32API is deprecated after Ruby 1.9.1; use fiddle directly instead
[?] Would you like to init the webservice? (Not Required) [no]: yes
====================================================================
Running the 'init' command for the database:
Creating database at C:/Users/Dinamitrii/.msf4/db
[!] Attempt to create DB socket file at Temporary Directory and `~/.msf4/db` failed. Possibly because they are mounted with NOEXEC flags. Database initialization failed.
Starting database at C:/Users/Dinamitrii/.msf4/db...C:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:415:in `value':
here process hangs up again and have to CTRL+C
Interrupt
from C:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:415:in `block in capture2e'
from C:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:227:in `popen_run'
from C:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:209:in `popen2e'
from C:/metasploit-framework/embedded/lib/ruby/3.0.0/open3.rb:398:in `capture2e'
from C:/metasploit-framework/embedded/framework/lib/msfdb_helpers/db_interface.rb:55:in `run_cmd'
from C:/metasploit-framework/embedded/framework/lib/msfdb_helpers/pg_ctl.rb:98:in `start'
from C:/metasploit-framework/embedded/framework/lib/msfdb_helpers/pg_ctl.rb:35:in `init'
from C:/metasploit-framework/bin/../embedded/framework/msfdb:201:in `init_db'
from C:/metasploit-framework/bin/../embedded/framework/msfdb:945:in `invoke_command'
from C:/metasploit-framework/bin/../embedded/framework/msfdb:1080:in `block in <main>'
from C:/metasploit-framework/bin/../embedded/framework/msfdb:1077:in `each'
from C:/metasploit-framework/bin/../embedded/framework/msfdb:1077:in `<main>'
Terminate batch job (Y/N)? y
PS C:\metasploit-framework\bin>
so thats it.help pls :)
Please use triple backslash to create code blocks for output in future otherwise it will be hard to follow what you are saying due to formatting issues. I have gone ahead and corrected this for you in your previous post.
Thanks for posting your output, definitely seems like there is some deeper issue, particularly as Jeffery pointed out during our discussions, it seems odd that a Linux path is being attempted on a Windows host. We primarily support Linux first and then MacOS followed by Windows so I imagine this may have been a side effect of this support process and someone forgot to take into account Windows hosts when deciding how to create the socket file.
I'll have to set up a Windows 10 box myself and run through this but my guess is we will mark this with the Confirmed
label and we will need to dig into this deeper to determine if its just the Linux path issue or if that is only one symptom and there are deeper issues afoot here. Unfortunately I'm off work until middle of next week so I won't be able to get to this before then, but I'll try dig into this more when I get a chance.
Appreciate you bringing this to our attention!
@gwillcox-r7 thank you so much i'm appreciated, and i'll wait much as possible.thanks again.
Linking this with https://github.com/rapid7/metasploit-framework/issues/17327 which seems to be a duplicate report of this issue.
Alright so after speaking to Jeffery Martin on this he pointed out that this is likely due to the code that was added by @3V3RYONE at https://github.com/rapid7/metasploit-framework/pull/16094/files, specifically r.e test_executable_file
and the calls that are made to it. test_executable_file
uses a Linux based approach that is sound for Linux based systems but it seems that when I merged this commit in I forgot to also account for Windows systems and broke things in the process 😓 So this code will need to be updated to account for that. (Also @3V3RYONE only tagging you here since I thought you'd be interested in the analysis, still appreciate the update you made to this code, just thought you might be interested in seeing the adjustments here given it is your code👍)
Additionally the error message here would need to be updated to account for Windows since in the logs it says its trying to star the database at ~/.msf4/db
whereas in reality its starting it on your system at C:/Users/Dinamitrii/.msf4/db
.
Once these changes are made we should be able to retest and see if there are any further updates that might need to be done to get it working on Windows again, should any additional issues arise.
Excuse me but how do i compile this on Windows or which version of Metasploit will include new modifications???
@Dinamitrii Code modifications have not been made yet.
ok I'll wait.
@gwillcox-r7 I'm sorry just for info is the code modifications already made or I'll need to wait some more time if you find a bit of time please let me know,if you don't I'll just wait some more time.Don't worry to hurry I have a lot of time but not endless.When you can please let me know.Thank you in advance.
@gwillcox-r7 I'm sorry just for info is the code modifications already made or I'll need to wait some more time if you find a bit of time please let me know,if you don't I'll just wait some more time.Don't worry to hurry I have a lot of time but not endless.When you can please let me know.Thank you in advance.
This issue is not yet resolved. If you are in a hurry I suggest using Metasploit on Linux instead.
@bcoles Thank you for the fast response.In this peticullar case i have time to wait this exact solution because i need it for one of my clients and is just not possible to take advantage of Linux and Metasploit like i did personally, so thank you but if i have to wait for the solution I'll just wait as long as possible for me that is not a problem,but kindly please you and all of the support crew, just inform me when the changes have been implemented in a working version of Metasploit-Framework for Windows and is possible for me to do my job from there and on but that is mine concern.Please that is my one and only request for you and support crew of Metasploit,just inform me for that when code changes have been made and is possible for me to update current version with the new one from offical site download location or either thru "msfupdate.bat" for me just do not have matter how do i achieve this.Thank you once again for fast response and for your time,I'm counting on you.
@Dinamitrii Currently the team has come back from a 2 week vacation and is busy catching up on PRs and preparing for the release of 6.3 of Metasploit. Once this is complete we will likely have some more time to take a look at this. Unfortunately at this point in time I don't have a timeline on when that will be complete however we are aiming to have 6.3 out in the next 2-3 weeks.
@gwillcox-r7 Ok.I'll wait no problem at this time.I'll check again after a month more or less don't worry.I know and understand when team like your's have to reach goals or some kind of deadline.Just keep me in mind and if I do not ask here on time just put a comment when ready and if needed close the given issue with it.Thank you a lot again to find free time to keep me informed on time.Thank you and good luck with current job.
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.
Anyone find a work around for this?