Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 2D5E4632882 for ; Tue, 4 May 2010 11:24:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 94268-03 for ; Tue, 4 May 2010 14:24:30 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 573826327FC for ; Tue, 4 May 2010 11:24:30 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id o44EORc1011069; Tue, 4 May 2010 10:24:27 -0400 (EDT) To: "Daniel J. Summers" cc: pgsql-admin@postgresql.org Subject: Re: Ubuntu 10.04 - Cannot Create TCP/IP Sockets In-reply-to: <4BDFA003.2080706@djs-consulting.com> References: <4BDE46F4.4070401@djs-consulting.com> <1CA7FF980DA3824F9A5C31532B7A40DCCDCE01FD@LCXCLMB01.LCDS.LOC.GOV> <4BDEC707.1090403@gmail.com> <14337.1272894755@sss.pgh.pa.us> <4BDED7E2.5060304@djs-consulting.com> <15098.1272896449@sss.pgh.pa.us> <4BDFA003.2080706@djs-consulting.com> Comments: In-reply-to "Daniel J. Summers" message dated "Tue, 04 May 2010 04:18:11 -0000" Date: Tue, 04 May 2010 10:24:27 -0400 Message-ID: <11068.1272983067@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_FRT_STOCK2=0.01, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/39 X-Sequence-Number: 34512 "Daniel J. Summers" writes: > On 05/03/2010 02:20 PM, Tom Lane wrote: >> OK, what about 127.0.0.1? Given that "dig localhost" returns that, >> it *should* behave the same, but obviously something here is not >> behaving as expected. Also, after you start it with '*', does >> "psql -h localhost" work? > Yes on both accounts. When I had 127.0.0.1 or *, it both started up, > and psql -h localhost gave me a password prompt. Huh. Well, there seems to be no other possible conclusion except that getaddrinfo() is returning something valid for "127.0.0.1" but not for "localhost". And it's not failing outright for "localhost", but returning a sockaddr that bind() won't actually accept. I'm guessing that there's some sort of IPv4-vs-IPv6 confusion involved here, but it's hard to say more. We might be able to learn something if you strace the postmaster while it's trying to start up with "localhost" as the setting. There will be a lot of output, so send it to a file. Look for the bind() calls --- on my Linux box the relevant part of the trace looks like this: socket(PF_INET6, SOCK_STREAM, IPPROTO_IP) = 3 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 setsockopt(3, SOL_IPV6, IPV6_V6ONLY, [1], 4) = 0 bind(3, {sa_family=AF_INET6, sin6_port=htons(5432), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0 listen(3, 208) = 0 socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4 setsockopt(4, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 bind(4, {sa_family=AF_INET, sin_port=htons(5432), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 listen(4, 208) = 0 getppid() = 12399 open("/tmp/.s.PGSQL.5432.lock", O_RDWR|O_CREAT|O_EXCL, 0600) = 5 write(5, "12400\n/var/lib/pgsql/data"..., 33) = 33 close(5) = 0 unlink("/tmp/.s.PGSQL.5432") = -1 ENOENT (No such file or directory) socket(PF_FILE, SOCK_STREAM, 0) = 5 bind(5, {sa_family=AF_FILE, path="/tmp/.s.PGSQL.5432"}, 110) = 0 chmod("/tmp/.s.PGSQL.5432", 0777) = 0 listen(5, 208) = 0 which shows the postmaster opening up both IPv6 and IPv4 sockets as well as a Unix-domain socket in /tmp. regards, tom lane