Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j2T8s-0002Jb-LB for pgsql-general@arkaria.postgresql.org; Fri, 14 Feb 2020 05:03:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j2T8r-0000wO-F1 for pgsql-general@arkaria.postgresql.org; Fri, 14 Feb 2020 05:03:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j2T8r-0000wA-2B for pgsql-general@lists.postgresql.org; Fri, 14 Feb 2020 05:03:53 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1j2T8o-00028B-9S for pgsql-general@lists.postgresql.org; Fri, 14 Feb 2020 05:03:51 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 755E1220E7; Fri, 14 Feb 2020 00:03:49 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 14 Feb 2020 00:03:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:from:to:references:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=f Neo6QhXTt2lIe/79YWrj6Eun3B/dNgijqDi5IwHWcI=; b=EY04K1pLVf3id6lA0 4SVD2KDHlSeH/2wBh0mjAl2IqDi1UYKel5hbvOMFCpL1PA5+/BKRBo1ZqkDowru2 wSrXUMQVEucrr+rz31Bo5HcU4wi2RGt4Gwl5zhoWdCKnHNaazVcsLftmsm5SljG0 8P4Q9WuPozwNldNqYf9BOWs7J41NpW44Im2dHAVO4ps60VGLkdGmc4VGvn0N11p5 l5cK48YGSen916kE2qVaDRDlXCkuRvHa0I864RMTixcpcpcDRgCzbHAWku5BdvbW ChEyYnlNbbWqXlueRYgwSznrwGRRvOM6iFASGHdD/domi5OAJmWGMelqOT7dTK98 F5CKA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=fNeo6QhXTt2lIe/79YWrj6Eun3B/dNgijqDi5IwHW cI=; b=NYOnPHwjH7OA7eNIZb6jfUbcZEBBscz0zHLIeFWDitEwZgOgkJy0noX8u lB0ajNCVzNocGCkBDYGXZbFfEwPJ9WPDNMcNwa0C0bXjPB0nSXtq5gaWQiioq5Ak DhqnKCTWEwDvJgVpHQUlS13lRefffPX/NPBGz/AUKQh2fLSfO0NLOUgfQCPFgFBI 36aqNjV/LSTGZdymGhG4ufaiaWVAhu5VpC/1+fzbn01wpmvj3T08cFJDZ7le2+kJ EO4kagQnMrR/Bg6zYKH8EaEzyD4bjtooUT+BFmvvx4Pi6idSYdanx5Y6BHGC/0Gd hkAnz4ucmx6MorBJzZXdpGgHzQ5wg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrieelgdejlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefuhffvfhfkffgfgggjtgfgsehtkeertddtfeejnecuhfhrohhmpeetughrihgr nhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomh eqnecukfhppeejuddrvdduvddruddvledrudelfeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrg hvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.10] (unknown [71.212.129.193]) by mail.messagingengine.com (Postfix) with ESMTPA id CA2473060D1A; Fri, 14 Feb 2020 00:03:48 -0500 (EST) Subject: Re: Cannot connect to postgresql-11 from another machine after boot From: Adrian Klaver To: Jason Swails , pgsql-general@lists.postgresql.org References: <4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com> Message-ID: Date: Thu, 13 Feb 2020 21:03:48 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <4e04fcba-2921-df12-c1a5-7a3eb5afb1eb@aklaver.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2/13/20 9:02 PM, Adrian Klaver wrote: > On 2/13/20 7:54 PM, Jason Swails wrote: >> Hi, >> >> I've been struggling with a strange (to me) issue for awhile.  I have >> PostgreSQL 11.6 installed on my Ubuntu machine with the data directory >> living on a different drive than the one mounted on /. I was observing >> the same behavior when my machine was running Gentoo a month ago. >> >> The problem is that after my machine boots, I'm unable to connect to >> the server from anywhere except localhost.  Running a simple >> "systemctl restart postgresql" fixes the problem and allows me to >> connect from anywhere on my LAN.  Here is an example of this behavior: >> >> swails@client ~ $ psql -U postgres -h 192.168.1.3 >> psql: could not connect to server: Connection refused >> Is the server running on host "192.168.1.3" and accepting >> TCP/IP connections on port 5432? >> >> swails@client ~ $ ssh 192.168.1.3 >> >> swails@server ~ $ sudo systemctl restart postgresql >> >> swails@server ~ $ logout >> Connection to 192.168.1.3 closed. >> >> swails@client ~ $ psql -U postgres -h 192.168.1.3 >> Password for user postgres: >> >> So the first connection attempt fails.  But when I restart the service >> and try again (doing nothing else in between), the connection attempt >> succeeds.  My workaround has been to simply restart the service every >> time my machine reboots, but I'd really like to have a more reliable >> startup. >> >> Any ideas how to start hunting down the root cause?  I think this >> started happening after I moved the data directory to another drive. > > I would start by looking in the system log to see what it records when > the service tries to start on reboot. Hit send to soon. At a guess the Postgres service is starting before the drive is mounted. > >> >> Thanks, >> Jason >> >> -- >> Jason M. Swails > > -- Adrian Klaver adrian.klaver@aklaver.com