Skip to main content

NeXpose and BackTrack 4: “Could not start the nxpgsql daemon” [Fixed]

By December 21, 2009How To

UPDATE/Fix Information:
I found out that this was all related to the previous solution of disabling the postgresql instance on the machine. I had (mistakenly) thought that by doing /etc/init.d/postgresql-8.3 stop that BackTrack’s posgresql instance would stop. Unfortunately I was wrong, and a “ps aux | grep -i sql” showed me this. After I did a “kill <PID>” I removed all NeXpose files/folders and reinstalled it. However it still wouldnt run correctly/gave me the same error. After some discussion in #rapid7 on irc.freenode.net, I was informed that NeXpose requires 1GB of RAM. So I edited my VMWare config to provide 1GB of RAM to my BackTrack guest.

However, then I had another issue — the NeXpose server kept crashing after starting. So, again I turned to the guys in #rapid7. With their help, I ran “cd /opt/rapid7/nexpose/nsc && rm conf/nsc.xml && ./nsc.sh” and voila! Success!

So, to reiterate, to fix “Could not start the nxpgsql daemon,” I:

  • Determine the running PostgreSQL’s PID by doing “ps aux | grep -i sql”
  • “kill <PID>” the offending PID from above
  • Reinstall NeXpose
  • If you are utilizing VMWare or some virtualization software, increase the VM’s RAM to 1GB (or greater)
  • Delete nsc.xml from /opt/rapid7/nexpose/nsc/conf/
  • Start the NeXpose daemon

Again, the cause of the “Could not start the nxpgsql daemon” is due to the fact that the nxpgsql server is trying to start, but there is already an existing PostgreSQL server running. The nxpgsql server tries to use the same default port (5432) as the existing PostgresSQL server. Knowing this, I set out to fix this problem. Here’s how I did it:

  • Edit /opt/rapid7/nexpose/nsc/conf/nsc.xml
  • Change line #4 to say:?<Database dbms=”postgresql” db=”//127.0.0.1:5433/nexpose”>
    <Database dbms=”postgresql” db=”//127.0.0.1:5433/nexpose”>
  • Save nsc.xml
  • Edit /opt/rapid7/nexpose/nsc/nxpgsql/nxpdata/postgresql.conf
  • Uncomment line 60 and change it to say: “port = 5433 # (change requires restart)”
  • Save postgresql.conf


Original Post
After seeing this post showing neXpose running on BackTrack 4, I wanted to try installing it on my BT4 VM. So, I followed the instructions in this video.

I went to run the neXpose client/server after install (by doing ./nsc.sh), but was met with the following error message/log:

NSC 12/21/09 6:43 PM: Initializing postgresql database manager for //127.0.0.1:5432/nexpose…
postgresql 12/21/09 6:43 PM: Starting up postgresql DB system
postgresql 12/21/09 6:43 PM: Nexpose PostgreSQL service status: 0
postgresql 12/21/09 6:43 PM: Nexpose PostgreSQL service status: 1
NSC 12/21/09 6:43 PM: Database initialization failed : java.sql.SQLException: Error starting PostgreSQL: com.rapid7.os.OSException: Could not start the nxpgsql daemon
at com.rapid7.nexpose.datastore.A.K.E(Unknown Source)
at com.rapid7.nexpose.datastore.n.H(Unknown Source)
at com.rapid7.nexpose.datastore.n.E(Unknown Source)
at com.rapid7.nexpose.datastore.n.E(Unknown Source)
at com.rapid7.nexpose.nsc.NSC.U(Unknown Source)
at com.rapid7.nexpose.nsc.NSC.?(Unknown Source)
at com.rapid7.nexpose.nsc.NSC.?(Unknown Source)
at com.rapid7.nexpose.nsc.NSC.run(Unknown Source)
at com.rapid7.nexpose.nsc.NSC.main(Unknown Source)
Caused by: com.rapid7.os.OSException: Could not start the nxpgsql daemon
at com.rapid7.nexpose.datastore.A.K.A(Unknown Source)
… 9 more
SQLState=null, errorCode=0

So with that in mind I started Googling around to see what I could find. Long story short, I found the following:

  • neXpose Known Issues, which didn’t help at all/have any useful information
  • Metasploit Mailing List Post regarding a similar issue which told me to disable any existing postgresql instance and reinstall neXpose
  • neXpose Common Errors, which went so far as to suggest complete removal of postgresql from your system… which didn’t seem too logical to me seeing as Metasploit uses it…

So with all that said, I’m still stuck. I’m hoping that @rapid7 responds to my Tweet (@rapid7 HELP! Can’t get #neXpose to work on BT4. So far, no go: “Could not start the nxpgsql daemon.” Full error paste: http://bit.ly/6pJ1Ve), but we’ll see.

If anyone has encountered this before and/or has any ideas on how to fix it, please leave me a comment below. Thanks!

7 Comments

  • Chad Loder says:

    Hi Noah. I think I know what the issue may be. Look at the contents of /opt/rapid7/nexpose/nsc/nxpgsql/nxpdata/nxpgsql.log. If this file exists, you may see an error message like the following:

    FATAL: could not create lock file “/tmp/.s.PGSQL.5432.lock”: Permission denied

    If you see this error message, this is because the nxpgsql user does not have permission to write to /tmp. If you chmod go+w /tmp, this should work for you when you restart NeXpose.

  • Bizaily says:

    Just Tweeted you, but it is hard to say the full error without the nxpgsql.log

  • Hey thanks for linking my video guide.
    Apparently the above problem still exists for some users.
    http://www.backtrack-linux.org/forums/experts-forum/27080-nexpose-backtrack-4-beta-vmware.html
    Just as a FYI I did not use BT4 beta but a vanilla BT4 Pre-Final as the base, not sure if that is what you did.

    Cheers

  • Logan says:

    Hy,

    is there any possibility to the same PostgreSql database with nexpose AND metasploit?
    I am using Backtrack5 with metasploit 3.7.2 and Postgresql as tutorialed here: http://www.backtrack-linux.org/forums/backtrack-5-experts-section/40377-bt5-metasploit-postgresql.html

    my regards

    • Noah says:

      Hi Logan,

      I don’t see any reason why you couldn’t use the same PostgreSQL database engine with both Nexpose and Metasploit. They would have their own databases within PostgreSQL. However, if you mean actually sharing data between the two, I’m not quite sure if that’d be possible.

      Apparently, per this link: https://community.rapid7.com/docs/DOC-1266, you can use a Nexpose plugin to integrate with Metasploit. Might try looking into that as well.

      Hope that helps. Let me know if I can do anything else!

      -Noah

  • TeNeX says:

    Hi i have an issue when start my nexpose installation cause i kill postgres PID by a finger mistake so obviously my nexpose send me the this error when log in:

    NeXpose has reported the following error:
    Critical error during initialization: Failed to init login module: SQL Exception: Database ‘nexpose’ not found.

    so when i go to “HOME” page shows following mistake:

    Home :: Error
    An error was encountered processing your request.

    Source page: /home.html

    Error code: 500

    Error message: server not configured to handle request for /home.html

    so… i though maybe whether a solution to avoid reinstallation is trying to restore a back up from other nexpose?

    • Noah says:

      You should be able to restart your postgresql daemon without having to totally reinstall Postgres. What OS are you installing this on?

Leave a Reply to Archangel.Amael Cancel Reply