If this is your first visit, be sure to
check out the Forum Rules by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

msfconsole not connecting to postgresql

ok.. I know the reason but not the solution.
msfconsole is giving me this message:

Code:

root@bt:~# msfconsole
[-] Failed to connect to the database: could not connect to server: Connection refused
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 7337?
could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 7337?
could not connect to server: Connection timed out
Is the server running on host "localhost" (192.168.56.101) and accepting
TCP/IP connections on port 7337?

when I try to start framework-postgres manually this is what I get:

Code:

root@bt:~# service framework-postgres start
LOG: could not bind IPv4 socket: Cannot assign requested address
HINT: Is another postmaster already running on port 7337? If not, wait a few seconds and retry.
FATAL: could not create shared memory segment: Invalid argument
DETAIL: Failed system call was shmget(key=7337001, size=41279488, 03600).
HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter. You can either reduce the request size or reconfigure the kernel with larger SHMMAX. To reduce the request size (currently 41279488 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
If the request size is already small, it's possible that it is less than your kernel's SHMMIN parameter, in which case raising the request size or reconfiguring SHMMIN is called for.
The PostgreSQL documentation contains more information about shared memory configuration.
/opt/metasploit/postgresql/scripts/ctl.sh : postgresql could not be started

When I run update-rc.d to update the start-up script I get the following output

Re: msfconsole not connecting to postgresql

hi hannah
i think (and maybe I'm wrong)... that the problem is "probably" caused post-update> 4.5.0. now the "ctlscript.sh" in the directory opt / metasploit/ handles both "" "postgresql-database" "" and "" metasploit-database "....maybe the problem is related to this!
I wish to solve
bye

Re: msfconsole not connecting to postgresql

Originally Posted by zimmaro

hi hannah
i think (and maybe I'm wrong)... that the problem is "probably" caused post-update> 4.5.0. now the "ctlscript.sh" in the directory opt / metasploit/ handles both "" "postgresql-database" "" and "" metasploit-database "....maybe the problem is related to this!
I wish to solve
bye

Re: msfconsole not connecting to postgresql

Re: msfconsole not connecting to postgresql

Welp, the ***** moderator killed my post linking to the solution on my website. So I'll paste it in. (It's not that hard to tell spam from ham, if you actually pay attention)

OS: Linux Mint 12 64 (An Ubuntu fork)

After installing Metasploit Pro, I tried to start the msfconsole and got the following database connection error:

Code:

[-] Failed to connect to the database: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 7337?

WTF? The server was running, and the port was not closed. The solution is to create a Metasploit rc script.
Find the location of your Metasploit ctlscript.sh file (mine was in /opt/metasploit-4.5.0/), and create the following script as /etc/init.d/metasploit-db-connection