About this list Date view Thread view Subject view Author view Attachment view

From: Sam Vilain (sam_at_vilain.net)
Date: Wed 20 Aug 2003 - 14:30:29 BST


    I am getting this error when trying to start postgresql (postmaster)
    in a vserver:PGSTAT: bind(2): Cannot assign requested address

Something else has the port open, probably a postgres instance running
on the master server. Running `netstat -plunt | grep 5432' should
show you which process is bound to the `postgres' port (5432). You
may need to run it within `chcontext --ctx 1 /bin/bash' to be sure to
see all processes that might have it open.

The thing to look for is lines like this:

tcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 560/perl

(there will be more spaces in the actual output of the program)

The process above (webmin, a perl program, with PID 560) is
`listening' or `bound' to 0.0.0.0, which means `all IPv4 interfaces on
the machine'. Most daemons will do this by default, thereby grabbing
the port for all interfaces on the machine.

In a vserver context with IP restrictions (assuming Alex/Herbert
haven't changed this on me :)), when a process tries to bind to
0.0.0.0, it is transparently altered to a bind to the primary address
of their vserver. This bind call fails, because another process
already has it open.

There are three simple solutions;

   1. run the daemon (postgres) with `chbind' to restrict it from
      binding to anything other than the master server's IP address -
      done by editing the /etc/init.d/* script.

   2. configure the daemon to restrict it's binding to the master
      server's IP address, see the manual.

   3. turn off the daemon in the master server, perhaps it is not
      needed

(Paul - I couldn't see the answer to this common `bind failed' message
in the FAQ - perhaps it deserves an entry?)

-- 
Sam Vilain, sam_at_vilain.net

I would have said yes to abortion if only it was right. I mean, yeah it's right. Well no it's not right that's why I said no to it. - George W. Bush, South Carolina, February 14, 2000


About this list Date view Thread view Subject view Author view Attachment view
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Wed 20 Aug 2003 - 14:51:56 BST by hypermail 2.1.3