Skip to main content

Failed to determine postgresql data directory

Comments

5 comments

  • cPanelMichael
    Hello @Luana Premoli, Can you check that no existing PostgreSQL processes are running on the server? EX: ps aux|grep postgres
    If so, you should first kill these processes. Then, move the PostgreSQL data directory out of the way and execute the installation script again using the below commands: mv /var/lib/pgsql /var/lib/pgsql-backup1 /scripts/installpostgres
    Note the above command assume you have no existing PostgreSQL databases to preserve. Thank you.
    0
  • Luana Premoli
    Hi, Does not work. I have already done this, as can be seen in the code I sent in the opening of this topic, but I did it again: root@vps.example.net [~]# ps aux | grep postgres root 23138 0.0 0.0 112708 976 pts/0 S+ 09:54 0:00 grep --color=auto postgres root@vps.example.net [~]# root@vps.example.net [~]# root@vps.example.net [~]# root@vps.example.net [~]# ll /var/lib/pgsql total 16K drwx------ 3 postgres postgres 4.0K May 16 10:23 . drwxr-xr-x. 34 root root 4.0K May 16 10:23 .. drwx------ 4 postgres postgres 4.0K May 16 10:23 9.6 -rwx------ 1 postgres postgres 267 May 16 10:23 .bash_profile root@vps.example.net [~]# root@vps.example.net [~]# mv /var/lib/pgsql /var/lib/pgsql-backup1 root@vps.example.net [~]# root@vps.example.net [~]# ll /var/lib/pgsql ls: cannot access /var/lib/pgsql: No such file or directory root@vps.example.net [~]# root@vps.example.net [~]# root@vps.example.net [~]# root@vps.example.net [~]# /scripts/installpostgres This script installs PostgreSQL 9.2.x or later. If your system runs an older version of PostgreSQL, you must dump your databases to a file, and then restore them after installation. PostgreSQL 9.2.x is NOT backwards compatible. If no PostgreSQL databases exist on your system, run the following command to force the creation of a PostgreSQL 9.2.x -style setup: mv /var/lib/pgsql /var/lib/pgsql.old systemctl restart postgresql Do not run this command if databases exist that you wish to keep! Are you certain that you wish to proceed? [y/(n)]:y Loaded plugins: fastestmirror, langpacks, universal-hooks Loading mirror speeds from cached hostfile * EA4: 184.94.196.94 * cpanel-addons-production-feed: 184.94.196.94 * cpanel-plugins: 184.94.196.94 No package rh-postgresql available. No package rh-postgresql-devel available. No package rh-postgresql-libs available. No package rh-postgresql-server available. Package postgresql96-9.6.13-1PGDG.rhel7.x86_64 already installed and latest version Package postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64 already installed and latest version Package postgresql96-libs-9.6.13-1PGDG.rhel7.x86_64 already installed and latest version Package postgresql96-server-9.6.13-1PGDG.rhel7.x86_64 already installed and latest version Failed to determine postgresql data directory The PostgreSQL installation failed. Building global cache for cpanel...Done root@vps.example.net [~]#
    Thanks.
    0
  • cPanelMichael
    Hello @Luana Premoli, Moving the PostgreSQL data directory and running the PostgreSQL installer script are required steps if the cause of the issue was the existence of hanging PostgreSQL processes (you'd have to perform those steps again if you identified and killed postgres processes). Since you found no running PostgreSQL processes, then those commands won't help (as you've already executed those commands per your initial post). Could you open a
    0
  • Luana Premoli
    Hi, Support Request ID is: 12415505 Thanks
    0
  • Luana Premoli
    The solution treated by the ticket. Hi, The reason this may be occuring is because the server has its own custom repository for postgresql. The repo appears to be: /etc/yum.repos.d/pgdg-redhat-all.repo The script is going to install from the CentOS Base repo, which defaults to 9.2. and before it was running Postgres 9.6 # rpm -qa | grep postgres postgresql96-9.6.13-1PGDG.rhel7.x86_64 postgresql96-server-9.6.13-1PGDG.rhel7.x86_64 postgresql96-libs-9.6.13-1PGDG.rhel7.x86_64 postgresql95-libs-9.5.17-1PGDG.rhel7.x86_64 postgresql95-9.5.17-1PGDG.rhel7.x86_64 postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64
    We've removed all packages: rpm -e --nodeps postgresql96-9.6.13-1PGDG.rhel7.x86_64 rpm -e --nodeps postgresql96-server-9.6.13-1PGDG.rhel7.x86_64 rpm -e --nodeps postgresql96-libs-9.6.13-1PGDG.rhel7.x86_64 rpm -e --nodeps postgresql95-libs-9.5.17-1PGDG.rhel7 .x86_64 rpm -e --nodeps postgresql95-9.5.17-1PGDG.rhel7.x86_64 rpm -e --nodeps postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64
    After have removed the above, can disable the repo: /etc/yum.repos.d/pgdg-redhat- # grep enabled=1 /etc/yum.repos.d/pgdg-redhat-all.repo enabled=1 enabled=1 enabled=1 enabled=1 enabled=1
    It should be checked whether the CentOS-Base.repo repository excluded postgresql # grep exclude /etc/yum.repos.d/CentOS-Base.repo exclude=postgresql* exclude=postgresql*
    Only remove these lines that postgres will install correctly. Thanks.
    0

Please sign in to leave a comment.