Results 1 to 8 of 8

Thread: msfconsole not connecting to postgresql

Hybrid View

  1. #1
    Senior Member
    Join Date
    Feb 2012
    Location
    Cyberspace
    Posts
    174

    Default 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.

  2. #2
    Good friend of the forums zimmaro's Avatar
    Join Date
    Mar 2010
    Location
    milano
    Posts
    407

    Default 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

  3. #3
    Senior Member
    Join Date
    Feb 2012
    Location
    Cyberspace
    Posts
    174

    Default Re: msfconsole not connecting to postgresql

    Quote Originally Posted by zimmaro View Post
    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.

  4. #4
    Senior Member
    Join Date
    Feb 2012
    Location
    Cyberspace
    Posts
    174

    Default Re: msfconsole not connecting to postgresql

    Anyone else.. Please help

  5. #5
    Just burned their ISO
    Join Date
    Feb 2013
    Posts
    1

    Default 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
    Last edited by sickness; 02-03-2013 at 11:04 PM. Reason: :) be polite

  6. #6
    Senior Member
    Join Date
    Feb 2012
    Location
    Cyberspace
    Posts
    174

    Default 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.

  7. #7
    Good friend of the forums zimmaro's Avatar
    Join Date
    Mar 2010
    Location
    milano
    Posts
    407

    Default 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

  8. #8
    Just burned their ISO
    Join Date
    Nov 2012
    Posts
    4

    Default 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 !

Similar Threads

  1. msfconsole & nexpose
    By hongman in forum BackTrack 5 General Topics
    Replies: 8
    Last Post: 05-08-2012, 09:01 PM
  2. msfconsole and smtp_enum
    By Mito125 in forum BackTrack 5 Beginners Section
    Replies: 1
    Last Post: 06-10-2011, 07:19 AM
  3. No Drivers available in msfconsole
    By kartoffelbreiei in forum BackTrack 5 Bugs
    Replies: 6
    Last Post: 05-16-2011, 09:07 AM
  4. msfconsole issue
    By mackbet in forum Beginners Forum
    Replies: 1
    Last Post: 10-06-2010, 04:54 AM
  5. Metasploit 3.3 - MsfConsole
    By regedit in forum Angolo dei Newbie
    Replies: 0
    Last Post: 01-21-2010, 07:53 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •