I am getting this error with Postgresql 8.4 on Ubuntu Hardy:

$./postgres -D /usr/local/pgsql/data
LOG:  could not bind IPv4 socket: Cannot assign requested address
HINT:  Is another postmaster already running on port 5432? If not, wait a few seconds and retry.
WARNING:  could not create listen socket for "localhost"
FATAL:  could not create any TCP/IP sockets

Here is my hosts file content (been finding a lot of stuff about this so just posting it now: localhost Home-Dev

Update: $ sudo netstat -tap | grep 5432 Came up blank.

I should also mention this is installed from source (I had original tried to install from the package and was getting the same error).

sudo /etc/init.d/postgres start

If you installed postgres via the package manager try that.

If it fails again, please post the contents of: sudo netstat -tap | grep 5432

  • It's actually /etc/init.d/postgresql-8.4. – Peter Eisentraut Dec 25 '10 at 5:46

I had no loopback interface installed. When I installed it postgres started working.


Assuming that is the IPv4 address of this machine that you are working on, I would like to point you to the following configuration files to look at: (the directory/pathnames may vary with relevance to your installation). You may find them in /etc/postgresql/8.4/main/ (found here in Ubuntu 10.04)

  • pg_hba.conf (/var/lib/pgsql/data/pg_hba.conf)
    • Comment out the other parameters and drop in the following
      • local all all trust
      • host all all trust
      • host all all ::1/128 trust
      • host all all trust
  • postgresql.conf (/var/lib/pgsql/data/postgresql.conf)
    • Ensure that the following parameter is pegged with a wildcard value
      • listen_address = '*'
    • Ensure that the following parameter is uncommented
      • port = 5432

You may want to amend/modify the values in the future once you have your PostgreSQL service up and running. :-) Hope this will be helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy