msfconsole not connecting to postgresql
My machine
Code:
root@bt:~# uname -a
Linux bt 3.2.6 #1 SMP Fri Feb 17 10:34:20 EST 2012 x86_64 GNU/Linux
Metasploit version:
Code:
msf > version
Framework: 4.6.0-dev.16226
Console : 4.6.0-dev.16333
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
Code:
root@bt:~# update-rc.d framework-postgres defaults
update-rc.d: warning: /etc/init.d/framework-postgres missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/framework-postgres already exist.
root@bt:~# update-rc.d metasploit-postgres defaults
update-rc.d: warning: /etc/init.d/metasploit-postgres missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
System start/stop links for /etc/init.d/metasploit-postgres already exist.
Please some one help.
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
Quote:
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
Mate I am not sure if I follow you here..apologies.
Re: msfconsole not connecting to postgresql
Anyone else.. Please help
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
Code:
#!/bin/sh
exec /your/path/to/ctlscript.sh "$@" postgresql
Change the file's permissions to 755.
chmod 755
Run the following:
Code:
update-rc.d metasploit-postgres defaults
Reboot your machine, and both PostgreSQL instances should be running.
Thanks to John Bize
Re: msfconsole not connecting to postgresql
I am now pulling metasploit from github...thanks for the solution but it is a bit too late for me. Thanks though I am sure it will help others.
Re: msfconsole not connecting to postgresql
I had "located" the problem correctly (see above-post) .. but I have not found the solution .... thanks for share backblast! :)
bye
Re: msfconsole not connecting to postgresql
do this,
Code:
cat /opt/metasploit/config/yml.config
see the data there, and then post the right info :)
ch33rs !