{"action":"created","issue":{"url":"https://api.github.com/repos/zalando/patroni/issues/840","repository_url":"https://api.github.com/repos/zalando/patroni","labels_url":"https://api.github.com/repos/zalando/patroni/issues/840/labels{/name}","comments_url":"https://api.github.com/repos/zalando/patroni/issues/840/comments","events_url":"https://api.github.com/repos/zalando/patroni/issues/840/events","html_url":"https://github.com/zalando/patroni/issues/840","id":374864195,"node_id":"MDU6SXNzdWUzNzQ4NjQxOTU=","number":840,"title":" OSError: [Errno 2] No such file or directory  (data = subprocess.check_output([self._pgcommand('pg_controldata'), self._data_dir], env=env))","user":{"login":"tomkcpr","id":18250402,"node_id":"MDQ6VXNlcjE4MjUwNDAy","avatar_url":"https://avatars3.githubusercontent.com/u/18250402?v=4","gravatar_id":"","url":"https://api.github.com/users/tomkcpr","html_url":"https://github.com/tomkcpr","followers_url":"https://api.github.com/users/tomkcpr/followers","following_url":"https://api.github.com/users/tomkcpr/following{/other_user}","gists_url":"https://api.github.com/users/tomkcpr/gists{/gist_id}","starred_url":"https://api.github.com/users/tomkcpr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomkcpr/subscriptions","organizations_url":"https://api.github.com/users/tomkcpr/orgs","repos_url":"https://api.github.com/users/tomkcpr/repos","events_url":"https://api.github.com/users/tomkcpr/events{/privacy}","received_events_url":"https://api.github.com/users/tomkcpr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-29T05:32:03Z","updated_at":"2018-10-29T07:59:13Z","closed_at":null,"author_association":"NONE","body":"Hey Guy's,\r\n\r\nWould this qualify as an issue with Patroni 3.2 and PostgreSQL 10?  \r\n\r\n```\r\n   1220     def controldata(self):\r\n   1221         \"\"\" return the contents of pg_controldata, or non-True value if pg_controldata call failed \"\"\"\r\n   1222         result = {}\r\n   1223         # Don't try to call pg_controldata during backup restore\r\n   1224         if self._version_file_exists() and self.state != 'creating replica':\r\n   1225             try:\r\n   1226                 env = {'LANG': 'C', 'LC_ALL': 'C', 'PATH': os.getenv('PATH')}\r\n   1227                 if os.getenv('SYSTEMROOT') is not None:\r\n   1228                     env['SYSTEMROOT'] = os.getenv('SYSTEMROOT')\r\n   1229                 data = subprocess.check_output([self._pgcommand('pg_controldata'), self._data_dir], env=env)\r\n   1230                 if data:\r\n   1231                     data = data.decode('utf-8').splitlines()\r\n   1232                     # pg_controldata output depends on major verion. Some of parameters are prefixed by 'Current '\r\n   1233                     result = {l.split(':')[0].replace('Current ', '', 1): l.split(':', 1)[1].strip() for l in data\r\n   1234                               if l and ':' in l}\r\n   1235             except subprocess.CalledProcessError:\r\n   1236                 logger.exception(\"Error when calling pg_controldata\")\r\n   1237         return result\r\n   1238\r\n\r\n```\r\n\r\n```\r\n\r\n[root@psql01 etcd]#\r\n[root@psql01 etcd]# journalctl -xe\r\n--\r\n-- Unit patroni.service has begun starting up.\r\nOct 29 01:20:06 psql01.nix.mds.xyz polkitd[678]: Unregistered Authentication Agent for unix-process:31878:12146769 (system bus name :1.178, object path /org/freedesktop/PolicyKit1/Au\r\nOct 29 01:20:06 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: 2018-10-29 01:20:07,138 INFO: Failed to import patroni.dcs.consul\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: 2018-10-29 01:20:07,167 INFO: Selected new etcd server http://192.168.0.108:2379\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: 2018-10-29 01:20:07,683 INFO: Lock owner: None; I am postgresql0\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: Traceback (most recent call last):\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/bin/patroni\", line 11, in <module>\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: load_entry_point('patroni==1.5.0', 'console_scripts', 'patroni')()\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib/python2.7/site-packages/patroni/__init__.py\", line 182, in main\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: return patroni_main()\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib/python2.7/site-packages/patroni/__init__.py\", line 149, in patroni_main\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: patroni.run()\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib/python2.7/site-packages/patroni/__init__.py\", line 114, in run\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: logger.info(self.ha.run_cycle())\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib/python2.7/site-packages/patroni/ha.py\", line 1236, in run_cycle\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: info = self._run_cycle()\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib/python2.7/site-packages/patroni/ha.py\", line 1177, in _run_cycle\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: data_sysid = self.state_handler.sysid\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib/python2.7/site-packages/patroni/postgresql.py\", line 423, in sysid\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: data = self.controldata()\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib/python2.7/site-packages/patroni/postgresql.py\", line 1229, in controldata\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: data = subprocess.check_output([self._pgcommand('pg_controldata'), self._data_dir], env=env)\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib64/python2.7/subprocess.py\", line 568, in check_output\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: process = Popen(stdout=PIPE, *popenargs, **kwargs)\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib64/python2.7/subprocess.py\", line 711, in __init__\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: errread, errwrite)\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: File \"/usr/lib64/python2.7/subprocess.py\", line 1327, in _execute_child\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: raise child_exception\r\nOct 29 01:20:07 psql01.nix.mds.xyz patroni[31884]: OSError: [Errno 2] No such file or directory\r\nOct 29 01:20:07 psql01.nix.mds.xyz systemd[1]: patroni.service: main process exited, code=exited, status=1/FAILURE\r\nOct 29 01:20:07 psql01.nix.mds.xyz systemd[1]: Unit patroni.service entered failed state.\r\nOct 29 01:20:07 psql01.nix.mds.xyz systemd[1]: patroni.service failed.\r\nOct 29 01:20:08 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\nOct 29 01:20:10 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\nOct 29 01:20:12 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\nOct 29 01:20:14 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\nOct 29 01:20:16 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\nOct 29 01:20:18 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\nOct 29 01:20:20 psql01.nix.mds.xyz Keepalived_vrrp[1248]: /usr/bin/killall -0 haproxy exited with status 1\r\n[root@psql01 etcd]#\r\n```\r\n\r\n```\r\n[root@psql01 etcd]# cat /etc/systemd/system/patroni.service\r\n[Unit]\r\nDescription=Runners to orchestrate a high-availability PostgreSQL\r\nAfter=syslog.target network.target\r\n\r\n[Service]\r\nType=simple\r\n\r\nUser=postgres\r\nGroup=postgres\r\n\r\nExecStart=/bin/patroni /etc/patroni.yml\r\n\r\nKillMode=process\r\n\r\nTimeoutSec=30\r\n\r\nRestart=no\r\n\r\n[Install]\r\nWantedBy=multi-user.targ\r\n\r\n[root@psql01 etcd]#\r\n```\r\n\r\n\r\nDespite that PGDATA is defined fine in .bash_profile:\r\n\r\n```\r\n-bash-4.2$ cat .bash_profile\r\n[ -f /etc/profile ] && source /etc/profile\r\nPGDATA=/data/patroni\r\nexport PGDATA\r\n# If you want to customize your settings,\r\n# Use the file below. This is not overridden\r\n# by the RPMS.\r\n[ -f /var/lib/pgsql/.pgsql_profile ] && source /var/lib/pgsql/.pgsql_profile\r\n-bash-4.2$ logout\r\n[root@psql01 etcd]#\r\n```\r\n\r\nOr is there a recommended approach that I might be missing?\r\n\r\nCheers,\r\nTK"},"comment":{"url":"https://api.github.com/repos/zalando/patroni/issues/comments/433818761","html_url":"https://github.com/zalando/patroni/issues/840#issuecomment-433818761","issue_url":"https://api.github.com/repos/zalando/patroni/issues/840","id":433818761,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzgxODc2MQ==","user":{"login":"CyberDem0n","id":3407345,"node_id":"MDQ6VXNlcjM0MDczNDU=","avatar_url":"https://avatars2.githubusercontent.com/u/3407345?v=4","gravatar_id":"","url":"https://api.github.com/users/CyberDem0n","html_url":"https://github.com/CyberDem0n","followers_url":"https://api.github.com/users/CyberDem0n/followers","following_url":"https://api.github.com/users/CyberDem0n/following{/other_user}","gists_url":"https://api.github.com/users/CyberDem0n/gists{/gist_id}","starred_url":"https://api.github.com/users/CyberDem0n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CyberDem0n/subscriptions","organizations_url":"https://api.github.com/users/CyberDem0n/orgs","repos_url":"https://api.github.com/users/CyberDem0n/repos","events_url":"https://api.github.com/users/CyberDem0n/events{/privacy}","received_events_url":"https://api.github.com/users/CyberDem0n/received_events","type":"User","site_admin":false},"created_at":"2018-10-29T07:59:13Z","updated_at":"2018-10-29T07:59:13Z","author_association":"MEMBER","body":"I am 100% sure Patroni can't find postgres binaries in the default PATH:\r\nhttps://github.com/zalando/patroni/issues/569\r\nhttps://github.com/zalando/patroni/issues/714\r\nhttps://github.com/zalando/patroni/issues/497\r\nand so on"}}
{"actor":{"display_login":"CyberDem0n"}}