Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fO5IF-00078Q-Nd for pgsql-general@arkaria.postgresql.org; Wed, 30 May 2018 17:53:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fO5IE-0001W1-6p for pgsql-general@arkaria.postgresql.org; Wed, 30 May 2018 17:53:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fO5ID-0001Vr-5w for pgsql-general@lists.postgresql.org; Wed, 30 May 2018 17:53:49 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fO5I8-0004sR-NA for pgsql-general@postgresql.org; Wed, 30 May 2018 17:53:48 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7423E21C7C; Wed, 30 May 2018 13:53:43 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 30 May 2018 13:53:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=58taz3rKc5XnWPayeAMIDZArsalnp dxf99AxoIRVjw4=; b=3JelajAod6vCR65Uh43Fe+Qi4Cf3PSc2vkNeOdP1SHvqy khz5WV1xWiWETO9NSq3SOWco7PDESzz4yVTOF2O3Wu1WpWNKHsFdkSj/cIWdbdCW eS5vgX6ATatPpQLQWxeXPrxb+bg8E/tlHicfW1OPR3st4CnRb1ida1Cd/oUP5uJI ZC/Hz7crHLcl7Lk2328THwDXP1Selx0uhMaunOxjZmI1Qljk1A67ReG/q16k8Bma QI6ogSt/3ot7H4K2mQWKsJu+g2EBuHWKw03zzN+VRbTWgp8/dj3N6r2hUkO2COSN rUMrc4mREK29ly62XhXSIWIRrd+YNNa69jJm+QTsw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=58taz3 rKc5XnWPayeAMIDZArsalnpdxf99AxoIRVjw4=; b=QEedihv2ZVdmZED3krO7bm s1B4Wcq9CfIzhZzplDcAdIPVc+a6LtYVOTHLlSUdNxBxgzIKgYND4H1/7y4hjnh1 6N8nkQ/8WXhamNei+5hnjY9BUBEXsiLyRABgft7lSSpA2ZNktUm3WRUF8XKdlzAd zDAIyxHOTTvjWZO35JKVL+l7HmkhCB2F4NBTSTAUB/aYpTShhmEr9T/6wICYWf6L u/dOxI5cv7/AZbqdKZLna8blbORuK73fbfY1ZTDiBjtKQR1B+Tr9iPYyKC3ObMIX eRxY92BIeVV2tP6FaGdL4XQcNxBqJzxW1cLzwh1croNmWIn8vswvAmW9T5taocEQ == X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from ranger.suse (unknown [74.94.73.222]) by mail.messagingengine.com (Postfix) with ESMTPA id 98FB21025C; Wed, 30 May 2018 13:53:42 -0400 (EDT) Subject: Re: Pgagent is not reading pgpass file either in Windows or Linux. To: nageswara Bandla Cc: pgsql-general@postgresql.org References: <5595335e-32e8-80da-9c65-8d79fce554a7@aklaver.com> <12119160-c746-926a-110a-f82a0e769728@aklaver.com> From: Adrian Klaver Message-ID: <98dc353c-8d69-49d6-5ee9-01f53344d284@aklaver.com> Date: Wed, 30 May 2018 10:53:41 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: 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 05/30/2018 08:48 AM, nageswara Bandla wrote: > > > On Tue, May 29, 2018 at 6:15 PM, Adrian Klaver > > wrote: > > On 05/29/2018 03:57 PM, nageswara Bandla wrote: > > #1. Windows: > > My guess because the LocalSystem user does not have permissions > on your: > %APPDATA%/postgresql/pgpass.co > nf > file. This seems to be confirmed by it working when you run > pgagent as the login user. > Also: > passfile >      Specifies the name of the file used to store passwords > (see Section 33.15). Defaults to ~/.pgpass, or > %APPDATA%\postgresql\pgpass.co > nf on Microsoft Windows. (No error is reported > if this file does not exist.) > > > Does that mean we can not use pgagent (when installed)  as a > "LocalSystem" service account and define PGPASSFILE to a valid > accessible location. ? > > > Not sure as I do not use Windows much and do not have a good handle > on how it handles permissions. You might try raising an issue below > to see if you can get some guidance: > > > > Thank you Adrian, let me also try to raise an issue there and see. > > > > I am running pgagent command from postgres system user account where > .pgpass is setup. > > It’s definitely not a library issue. Since the same pgagent command that > I gave earlier is working fine by  appending  “password=secret” at the > end in pgagent command line. That in of itself does not eliminate library issues as supplying the password removes the need for libpq to search for a .pgpass or env variable specifying the file or the password itself and that is where pgagent seems to be having the problem. This is more of a comment for future troubleshooting then the present as reducing the Postgres versions to one eliminates library issues. > > */usr/bin/pgagent_96 -f -l 2 hostaddr=127.0.0.1 dbname=linuxpostgresdb > user=postgres port=5432 password=secret* > > * > * > > Anyway, I have tried your suggestion to clean up old postgres libraries > and tried to keep only one version of postgres libraries exist in the > entire system. It’s still same issue. > > And I am trying in the same machine where the postgres is installed. > > > > > > When I run psql from postgres user; It works fine. > * > * > */usr/bin/pgagent_96 -f -l 2 hostaddr=127.0.0.1 > dbname=linuxpostgresdb user=postgres port=5432* > DEBUG: Creating primary connection > DEBUG: Connection Information: > DEBUG:      user         : postgres > DEBUG:      port         : 5432 > DEBUG:      host         : 127.0.0.1 > DEBUG:      dbname       : linuxpostgresdb > DEBUG:      password     : > DEBUG:      conn timeout : 0 > DEBUG: Connection Information: > DEBUG:      user         : postgres > DEBUG:      port         : 5432 > DEBUG:      host         : 127.0.0.1 > DEBUG:      dbname       : linuxpostgresdb > DEBUG:      password     : > DEBUG:      conn timeout : 0 > DEBUG: Creating DB connection: user=postgres port=5432 > hostaddr=127.0.0.1 dbname=linuxpostgresdb > WARNING: Couldn't create the primary connection (attempt 1): > fe_sendauth: no password supplied > DEBUG: Clearing all connections > DEBUG: Connection stats: total - 1, free - 0, deleted - 1 > > *# psql command is running fine:* > psql -h 127.0.0.1 -d linuxpostgresdb -U postgres > > psql (8.4.20, server 9.6.6) > WARNING: psql version 8.4, server version 9.6. >           Some psql features might not work. > Type "help" for help. > > linuxpostgresdb=# > > > > > > > -- > Adrian Klaver > adrian.klaver@aklaver.com > > -- Adrian Klaver adrian.klaver@aklaver.com