Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after new git pull msfdb error postgresql not in the path #10939

Closed
4 tasks
lacroutelacroute opened this issue Nov 9, 2018 · 7 comments
Closed
4 tasks

after new git pull msfdb error postgresql not in the path #10939

lacroutelacroute opened this issue Nov 9, 2018 · 7 comments

Comments

@lacroutelacroute
Copy link

Steps to reproduce

after git pull

:~/metasploit-framework$ ./msfdb reinit
Missing requirement: PostgreSQL does not appear to be installed or is not in the environment path

but Nightly build work fine

everything worked very well some time ago

kali rolling up to date
How'd you do it?

  1. ...
  2. ...

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

What should happen?

Current behavior

What happens instead?

You might also want to check the last ~1k lines of
/opt/metasploit/apps/pro/engine/config/logs/framework.log or
~/.msf4/logs/framework.log for relevant stack traces

System stuff

Metasploit version

Get this with the version command in msfconsole (or git log -1 --pretty=oneline for a source install).

I installed Metasploit with:

OS

What OS are you running Metasploit on?

@mkienow-r7
Copy link
Contributor

mkienow-r7 commented Nov 13, 2018

If I understand correctly you are attempting to use msfdb from a source install ("after git pull"). The nightly installer build is currently from the 4.x branch, while the master branch is 5.x. In addition, the nightly installer build packages its own copy of PostgreSQL which it adds to the path dynamically.

If you would like to use the source from GitHub I would suggest reviewing the wiki on Setting Up a Metasploit Development Environment. Depending on your current setup, you may only need to install PostgreSQL on your system to get up and running.

@lacroutelacroute
Copy link
Author

lacroutelacroute commented Nov 13, 2018 via email

@mkienow-r7
Copy link
Contributor

mkienow-r7 commented Nov 13, 2018

The reason you are getting the message "PostgreSQL does not appear to be installed or is not in the environment path" from msfdb is one or more of the following commands is not found on in your path: psql, pg_ctl, initdb, createdb. ./msfconsole can start and work without a database. Are you certain the ./msfconsole from the repo is connected to a database?

Would you provide the output from the following commands:

  1. From your terminal: postgresql_cmds=( psql pg_ctl initdb createdb ); for i in "${postgresql_cmds[@]}"; do which $i; done
  2. From inside ./msfconsole: db_status and db_connect -l

@lacroutelacroute
Copy link
Author

lacroutelacroute commented Nov 13, 2018 via email

@mkienow-r7
Copy link
Contributor

I'm not familiar with how Kali handles their PostgreSQL installation, but the reason msfdb is not working as you expect is because a few PostgreSQL binaries used by msfdb are not found in your path. Do the following files exist: /usr/bin/pg_ctl and /usr/bin/initdb? If so, ensure they are a part of your path and msfdb should start as expected.

@rhertzog
Copy link

rhertzog commented Feb 7, 2019

Debian (and thus Ubuntu and Kali as well) do not provide pg_ctl and initdb in the default PATH. Those binaries are only available in the versioned directories /usr/lib/postgresql/XX (eg /usr/lib/postgresql/11 for PostgreSQL 11).

See #11369 for my request to better handle this case.

@mkienow-r7
Copy link
Contributor

@rhertzog I agree having looked into this further since this issue was opened. We have a ticket on our backlog to address using the postgresql-common package included in Debian / Kali. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants