when I started my working sinatra app on my Raspberry pi rev 1 machine running wheezy with the latest apt-get upgrade a few weeks ago I find that my postgresql 9.1 server is no longer running. Hunting in my logs I find this:

could not bind IPv4 socket: Cannot assign requested address 2015-08-17 08:32:17 CDT HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. 2015-08-17 08:32:17 CDT LOG: could not bind IPv6 socket:

Hunting the Googles I can report this:

lsof -i 5432:TCP => null result. Which would indicate that I have no other process running on port 5432? I've run top and can find nothing that looks like postgresql.

There is no pid file in /var/run/postgresql

This is my postgresql.conf file for this cluster. I've yanked out the commented lines in file locations and connections:

data_directory = '/var/lib/postgresql/9.1/main'     
hba_file = '/etc/postgresql/9.1/main/pg_hba.conf'               
ident_file = '/etc/postgresql/9.1/main/pg_ident.conf'   
external_pid_file = '/var/run/postgresql/9.1-main.pid'  
#listen_addresses = 'localhost'     # what IP address(es) to listen on;
port = 5432             # (change requires restart)
max_connections = 100           # (change requires restart)
unix_socket_directory = '/var/run/postgresql'       
ssl = true

The output of pg_lsclusters

Version Cluster   Port Status Owner    Data directory                     Log file
9.1     main      5432 down   postgres /var/lib/postgresql/9.1/main       /var/log/postgresql/postgresql-9.1-main.log   

Attempting sudo pg_ctlcluster 9.1 main stop yields: Cluster is not running.

As an experiment, I changed the port number in the conf file from 5432 to 5433 to see if it would start. The result is the same error output in that another postmaster may be using port 5433. So perhaps the pi is closing all the ports?

I'm unsure what to try next to understand. Clearly, postgres is seeing another 5432 running on startup that can't be found by me yet. Where should I look next? thanx, sam

2 Answers 2


This maybe not Raspberry Pi specific.

You actually commented out listen_addresses completely. I'd try listen_addresses='*' or set it to your DHCP or public IP. Then restart the postgres server.



In my case, I have written two external IP addresses in listen_addresses value as below:


and received the same error. I understood that when only specific ip addresses are allowed, this syntax is true providing that localhost address is also in the list, so writing like this worked for me:


Hope, this will help to someone like me.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.