2

I've got a VPS with Centos 6.4 installed. I used to have a VPS at Digital Ocean that when I start PostgreSQL or Monit that bind to localhost, they all work fine. But on the new VPS, when I have PostgreSQL listen to "localhost", PostgreSQL is saying:

WARNING: could not create listen socket for "localhost"

And Monit, when I tell Monit to listen on "localhost", Monit is saying:

http server: Could not create a server socket at port 2812 -- Cannot assign requested address

I wonder what could be wrong on my VPS that lead to such behavior. If I have PostgreSQL listen on '*' instead of "localhost" then it runs just fine.

Update:

My ifconfig -a

eth0      Link encap:Ethernet  HWaddr 00:50:56:0A:01:3D
          inet addr:xxx.xx.xxx.xxx  Bcast:103.27.236.127  Mask:255.255.255.192
          inet6 addr: fe80::250:56ff:fe0a:13d/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:198875 errors:0 dropped:0 overruns:0 frame:0
          TX packets:49492 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:135854898 (129.5 MiB)  TX bytes:7779876 (7.4 MiB)

lo        Link encap:Local Loopback
          LOOPBACK  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

My /etc/hosts

127.0.0.1               localhost.localdomain localhost localhost4 localhost4.localdomain4 CentOS64
::1             localhost localhost.localdomain localhost6.localdomain6 localhost6
4
  • Is the lo interface up? Aug 5, 2014 at 3:13
  • Look at your /etc/hosts file. Is there an entry for localhost for 127.0.0.1?
    – dmourati
    Aug 5, 2014 at 3:20
  • @MichaelHampton: I think so. I updated my ifconfig -a Aug 5, 2014 at 3:30
  • @dmourati I do have 127.0.0.1 for localhost Aug 5, 2014 at 3:30

1 Answer 1

4

Your lo interface is down. Note that it explicitly does not say it is UP and does not have its associated IP address of 127.0.0.1. I have no idea how that would have happened, as this should always be brought up.

If the lo interface is down, no programs can bind or connect to localhost.

Bring it up yourself:

ifup lo
1
  • You saved my day man. I'm trying to figuring out why it's down. Aug 5, 2014 at 3:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .