Top border of content Bottom border of content

Metasploit installation error

What's the problem?

I had some trouble installing some of the more recent versions of the Metasploit framework for I was getting an error message halfway through the installation process. The exact error message I got is depicted below.

Metasploit Error Message upon Installation

Basicly what the error message says is that the installation program was unable to connect to the postgres database server which comes with the installer.

What's the reason?

Since for me the problem occured mainly on slow machines I figured out that this probably is a timing problem. The installation process fires up the database and then tries to access it, but since the database has not yet finished starting the installer cannot connect to the database server, times out and installation fails.

How to solve this issue?

To solve the problem we need to delay the installer's attempt to access the database. I'll show you how to do this by going through the installation process step by step.

When starting the installer we are greeted by the welcome screen.

Metasploit Installation: Greeting Screen

Clicking next we get to the license agreement which we accept.

Metasploit Installation: License Agreement

Clicking next again were beeing asked for an installation directory.

Metasploit Installation: Select installation folder

Choose one that you like or take the default one and click Next.

Metasploit Installation: Do automatic updates (YES/NO)?

The installer then asks us whether we want it to regularly update automatically and after having confirmed our decision with Next the installation finally starts copying and decompressing files and whatever else it does.

Metasploit Installation: Proceeding Installation

Now comes the tricky part. We need to wait until the installer starts the postgres database and then pause the installation process before the Metasploit installer tries to connect to the database. For me the installer needed to be paused when the installation progress reached 44% and the installer said "Creating Link /opt/framework-3.7.2/postgresql/bin/postmaster" as depicted below.

Metasploit Installation: Critical moment at 44% installation progress

This may be different for another version of Metasploit but in general you just have to note where your installation failed before and then pause the installer a little moment before that.

When you hit the Cancel button the following window will appear asking you whether you really want to stop the installation.

Metasploit installation: Abort installation dialog

If after some time you click No the installation will proceed as if you had never interrupted it. All we have to do is wait long enough to let the database finish its startup before letting the installer continue its work.

If you have trouble hitting the Cancel button in the right moment you may want to try the following. Hit the cancel button a few seconds before you would actually need to and start a terminal window.

1. Issue a "ps -A" command in the terminal and check if the syngres database has started.
2. Put the focus on the dialog asking you whether you really want to abort the installation and place it somewhere where it does not obscure the installation progress window. Press tab until the No button is selected.
3. Place your mouse pointer over the Cancel button of the installer's progress window.
4. Now you can press the enter key to activate the No button and almost instantaniously hit the mouse button to press the Cancel button again letting the installer proceed just a very little bit.

Repeat steps 1 to 4 until you see several postgres processes started in the ps command's output. If the postgres database sucessfully started the "ps -A" command in your terminal window should look somewhat like this.

Metasploit Installation: Started postgres processes in ps -A

As you can see several postgres processes are running. If you made it to this point wait a little, maybe 20 seconds, before letting the installer continue. The installer then should proceed without any more complaints about not beeing able to connect to the postgres database.

Metasploit Installation: Installation Proceeds without errors

And finally the installer should tell us that the installation was completed successfully.

Metasploit Installation: Installation Complete Screen

If you have to start the installation progress again because you paused it too late and installation failed, you will have to wait a little for the next run until all postgres processes have finished and you will have to delete the installation directory so the installer will not complain on the next run.

Have fun :-)