Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED Failed to determine postgresql data directory

Discussion in 'Database Discussion' started by Luana Premoli, May 16, 2019.

Tags:
  1. Luana Premoli

    Luana Premoli Well-Known Member

    Joined:
    Oct 3, 2016
    Messages:
    55
    Likes Received:
    5
    Trophy Points:
    8
    Location:
    São Paulo/Brazil
    cPanel Access Level:
    Root Administrator
    Hi,

    My problem is the same as the topic:

    PostgreSQL is not running


    I tried to remove the RPMs, and install again as described but it did not work.

    Code:
    [email protected] [lib]# yum remove postgresql
    Loaded plugins: fastestmirror, langpacks, universal-hooks
    Resolving Dependencies
    --> Running transaction check
    ---> Package postgresql95.x86_64 0:9.5.17-1PGDG.rhel7 will be erased
    --> Processing Dependency: postgresql95(x86-64) = 9.5.17-1PGDG.rhel7 for package: postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64
    ---> Package postgresql96.x86_64 0:9.6.13-1PGDG.rhel7 will be erased
    --> Processing Dependency: postgresql96(x86-64) = 9.6.13-1PGDG.rhel7 for package: postgresql96-server-9.6.13-1PGDG.rhel7.x86_64
    --> Running transaction check
    ---> Package postgresql95-devel.x86_64 0:9.5.17-1PGDG.rhel7 will be erased
    ---> Package postgresql96-server.x86_64 0:9.6.13-1PGDG.rhel7 will be erased
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ===================================================================================================================================================================================================================
     Package                                                  Arch                                        Version                                                   Repository                                    Size
    ===================================================================================================================================================================================================================
    Removing:
     postgresql95                                             x86_64                                      9.5.17-1PGDG.rhel7                                        @pgdg95                                      6.8 M
     postgresql96                                             x86_64                                      9.6.13-1PGDG.rhel7                                        @pgdg96                                      7.5 M
    Removing for dependencies:
     postgresql95-devel                                       x86_64                                      9.5.17-1PGDG.rhel7                                        @pgdg95                                      8.2 M
     postgresql96-server                                      x86_64                                      9.6.13-1PGDG.rhel7                                        @pgdg96                                       19 M
    
    Transaction Summary
    ===================================================================================================================================================================================================================
    Remove  2 Packages (+2 Dependent packages)
    
    Installed size: 41 M
    Is this ok [y/N]: y
    Downloading packages:
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Erasing    : postgresql96-server-9.6.13-1PGDG.rhel7.x86_64                                                                                                                                                   1/4
      Erasing    : postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64                                                                                                                                                    2/4
      Erasing    : postgresql95-9.5.17-1PGDG.rhel7.x86_64                                                                                                                                                          3/4
      Erasing    : postgresql96-9.6.13-1PGDG.rhel7.x86_64                                                                                                                                                          4/4
      Verifying  : postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64                                                                                                                                                    1/4
      Verifying  : postgresql96-9.6.13-1PGDG.rhel7.x86_64                                                                                                                                                          2/4
      Verifying  : postgresql96-server-9.6.13-1PGDG.rhel7.x86_64                                                                                                                                                   3/4
      Verifying  : postgresql95-9.5.17-1PGDG.rhel7.x86_64                                                                                                                                                          4/4
    
    Removed:
      postgresql95.x86_64 0:9.5.17-1PGDG.rhel7                                                                 postgresql96.x86_64 0:9.6.13-1PGDG.rhel7
    
    Dependency Removed:
      postgresql95-devel.x86_64 0:9.5.17-1PGDG.rhel7                                                          postgresql96-server.x86_64 0:9.6.13-1PGDG.rhel7
    
    Complete!
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# rpm -qa|grep postgresql
    cpanel-postgresql-libs-9.2.24-2.cp1178.x86_64
    postgresql96-libs-9.6.13-1PGDG.rhel7.x86_64
    postgresql95-libs-9.5.17-1PGDG.rhel7.x86_64
    cpanel-postgresql-9.2.24-2.cp1178.x86_64
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# rpm -e --nodeps postgresql96-libs-9.6.13-1PGDG.rhel7.x86_64
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# rpm -e --nodeps postgresql95-libs-9.5.17-1PGDG.rhel7.x86_64
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# mv pgsql /home/hgtransf/pgsql3
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# ll pgsql
    ls: cannot access pgsql: No such file or directory
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# mv /root/.cpanel/datastore/ /root/.cpanel/datastore_OLD-15052019-3
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# /usr/local/cpanel/bin/build_global_cache
    Building global cache for cpanel...Done
    [email protected] [lib]#
    [email protected] [lib]# /usr/local/cpanel/bin/build_global_cache
    Building global cache for cpanel...Done
    [email protected] [lib]#
    [email protected] [lib]#
    [email protected] [lib]# service cpanel restart
    Redirecting to /bin/systemctl restart cpanel.service
    [email protected] [lib]#
    
    
    [email protected] [lib]# /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.
    Resolving Dependencies
    --> Running transaction check
    ---> Package postgresql95-devel.x86_64 0:9.5.17-1PGDG.rhel7 will be installed
    --> Processing Dependency: postgresql95-libs(x86-64) = 9.5.17-1PGDG.rhel7 for package: postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64
    --> Processing Dependency: postgresql95(x86-64) = 9.5.17-1PGDG.rhel7 for package: postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64
    ---> Package postgresql96.x86_64 0:9.6.13-1PGDG.rhel7 will be installed
    ---> Package postgresql96-libs.x86_64 0:9.6.13-1PGDG.rhel7 will be installed
    ---> Package postgresql96-server.x86_64 0:9.6.13-1PGDG.rhel7 will be installed
    --> Running transaction check
    ---> Package postgresql95.x86_64 0:9.5.17-1PGDG.rhel7 will be installed
    ---> Package postgresql95-libs.x86_64 0:9.5.17-1PGDG.rhel7 will be installed
    --> Finished Dependency Resolution
    
    
    Total download size: 9.5 M
    Installed size: 43 M
    Downloading packages:
    --------------------------------------------------------------------------------
    Total                                              2.3 MB/s | 9.5 MB  00:04
    Running transaction check
    Running transaction test
    Transaction test succeeded
    Running transaction
      Installing : postgresql95-libs-9.5.17-1PGDG.rhel7.x86_64                  1/6
       Installing : postgresql96-libs-9.6.13-1PGDG.rhel7.x86_64                  2/6
       Installing : postgresql96-9.6.13-1PGDG.rhel7.x86_64                       3/6
       Installing : postgresql95-9.5.17-1PGDG.rhel7.x86_64                       4/6
       Installing : postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64                 5/6
       Installing : postgresql96-server-9.6.13-1PGDG.rhel7.x86_64                6/6
       Verifying  : postgresql95-devel-9.5.17-1PGDG.rhel7.x86_64                 1/6
       Verifying  : postgresql96-9.6.13-1PGDG.rhel7.x86_64                       2/6
       Verifying  : postgresql95-libs-9.5.17-1PGDG.rhel7.x86_64                  3/6
       Verifying  : postgresql96-server-9.6.13-1PGDG.rhel7.x86_64                4/6
       Verifying  : postgresql96-libs-9.6.13-1PGDG.rhel7.x86_64                  5/6
       Verifying  : postgresql95-9.5.17-1PGDG.rhel7.x86_64                       6/6
    
    Complete!
    Failed to determine postgresql data directory
    The PostgreSQL installation failed.
    Building global cache for cpanel...Done
    [email protected] [lib]#
    [email protected] [lib]#
    
    
    [email protected] [lib]# ll pgsql/
    total 16K
    drwx------   3 postgres postgres 4.0K May 16 09:31 .
    drwxr-xr-x. 34 root     root     4.0K May 16 09:31 ..
    drwx------   4 postgres postgres 4.0K May 16 09:31 9.6
    -rwx------   1 postgres postgres  267 May 16 09:31 .bash_profile
    [email protected] [lib]#
    


    I run /scripts/upcp --force and this is the log:

    - Removed -



    Code:
    [email protected] [lib]# cat /etc/redhat-release && grep '' /usr/local/cpanel/version
    CentOS Linux release 7.6.1810 (Core)
    11.78.0.23
    [email protected] [lib]#
    

    Can help me?

    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #1 Luana Premoli, May 16, 2019
    Last edited by a moderator: May 16, 2019
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,534
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Luana Premoli,

    Can you check that no existing PostgreSQL processes are running on the server? EX:

    Code:
    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:

    Code:
    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.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. Luana Premoli

    Luana Premoli Well-Known Member

    Joined:
    Oct 3, 2016
    Messages:
    55
    Likes Received:
    5
    Trophy Points:
    8
    Location:
    São Paulo/Brazil
    cPanel Access Level:
    Root Administrator
    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:


    Code:
    [email protected] [~]# ps aux | grep postgres
    root     23138  0.0  0.0 112708   976 pts/0    S+   09:54   0:00 grep --color=auto postgres
    [email protected] [~]#
    [email protected] [~]#
    [email protected] [~]#
    [email protected] [~]# 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
    [email protected] [~]#
    [email protected] [~]# mv /var/lib/pgsql /var/lib/pgsql-backup1
    [email protected] [~]#
    [email protected] [~]# ll /var/lib/pgsql
    ls: cannot access /var/lib/pgsql: No such file or directory
    [email protected] [~]#
    [email protected] [~]#
    [email protected] [~]#
    [email protected] [~]# /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
    [email protected] [~]#
    
    

    Thanks.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,534
    Likes Received:
    2,182
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    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 support ticket so we can take a closer look at the system? You can post the ticket number here and we'll link this thread to it.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. Luana Premoli

    Luana Premoli Well-Known Member

    Joined:
    Oct 3, 2016
    Messages:
    55
    Likes Received:
    5
    Trophy Points:
    8
    Location:
    São Paulo/Brazil
    cPanel Access Level:
    Root Administrator
    Hi,

    Support Request ID is: 12415505

    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael likes this.
  6. Luana Premoli

    Luana Premoli Well-Known Member

    Joined:
    Oct 3, 2016
    Messages:
    55
    Likes Received:
    5
    Trophy Points:
    8
    Location:
    São Paulo/Brazil
    cPanel Access Level:
    Root Administrator
    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

    Code:
    # 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:

    Code:
    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-

    Code:
    # 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

    Code:
    # grep exclude /etc/yum.repos.d/CentOS-Base.repo
    exclude=postgresql*
    exclude=postgresql*
    
    Only remove these lines that postgres will install correctly.



    Thanks.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice