-1

I am new to this forum, i am facing this issue, where i get the below error.

sudo -u shahid ./pg_ctl -D /root/pgsql10x/data/ initdb
invalid binary "/root/pgsql10x/bin/pg_ctl"
invalid binary "/root/pgsql10x/bin/pg_ctl"
invalid binary "/root/pgsql10x/bin/pg_ctl"

The program "initdb" is needed by pg_ctl but was not found in the same directory as "pg_ctl".

Check your installation.

I am trying to run this from root.

I have built from the source. I am trying version 10. on CentOS7. I downloaded direct from postgres site.

I am not facing this problem when I run as non-root user.

I have all the files in the bin directory, as shared in image here:

bin directory files

melpomene
  • 84,125
  • 8
  • 85
  • 148

2 Answers2

1

Finally, I was able to resolve the issue.

The problem was due to the built source was directly placed in "/root/" directory as /root/pgsql10x/ in root login.

when i placed it in "/app/" directory as /app/pgsql10x/ things started working normally, database got created and database got working without any problem (in root login).

-Shahid

0

The error comes from the fact that you are trying to start the cluster as the root user you'll have to switch to postgres and try restarting the cluster again

su - postgres
pg_ctl start
seshadri_c
  • 6,906
  • 2
  • 10
  • 24