Postgres Database startup failures with InitPgsql error trace

Postgres Database startup failures with InitPgsql error trace

  1. [com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer] [SEVERE] : Please login to the system as <machine_name>\Administrator and execute initPgsql.bat script with administrator privileges. If issue is not yet solved, please contact support

      During some of the upgrades or startup failures, you may come across this error when checking the logs. The above trace is printed every time the PostgreSQL server fails to start, which is more generic. We need to check the  "[pglog]" above this error message, in the same file to identify the exact cause. The possible causes of that failure are listed below. We need to follow different procedures to resolve that particular case based on the secondary trace we obtained.
      If this issue persist even after following below instructions, kindly report it to our support team with the below files.
  1. <product_installation_location>\logs
  2. <product_installation_location>\ pgsql \data \ pg_log
  3. Permission configuration, preferably command output or a screenshot of the folders <product_installation_location> , <product_installation_location>\pgsql\data,<product_installation_location>\pgsql\ext_conf, <product_installation_location> \tools directory.
  4. Output of initPgsql script.

Case 1 : Permission Restriction
  1. [com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer] [INFO] : Command to be executed [C:\ManageEngine\ServiceDesk\pgsql\bin\pg_ctl.exe, -w, -D, C:\ManageEngine\ServiceDesk\pgsql\data, -o, "-p65432", start]
  2. Mar 14, 2024 5:36:54 PM [pglog] [INFO] : waiting for server to start....postgres: could not access directory "C:/ManageEngine/ServiceDesk/pgsql/data": Permission denied
  3. Mar 14, 2024 5:36:54 PM [pglog] [INFO] : stopped waiting
  4. Mar 14, 2024 5:36:54 PM [pglog] [INFO] : pg_ctl: could not start server
(OR)
  1. Files\ManageEngine\ServiceDesk\pgsql\bin\pg_ctl.exe, -w, -D, C:\Program Files\ManageEngine\ServiceDesk\pgsql\data, -o, "-p65432", start] 
  2. 31/01/2024 10:45:41 AM  [pglog]  [INFO] : waiting for server to start....postgres: could not access directory "C:/Program Files/ManageEngine/ServiceDesk/pgsql/data": No such file or directory
  3. 31/01/2024 10:45:41 AM  [pglog]  [INFO] : Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
  4. 31/01/2024 10:45:41 AM  [pglog]  [INFO] :  stopped waiting
  5. 31/01/2024 10:45:41 AM  [pglog]  [INFO] : pg_ctl: could not start server
  6. 31/01/2024 10:45:41 AM  [pglog]  [INFO] : Examine the log output
(OR)
  1. home/cener/ManageEngine/ServiceDesk/pgsql/bin/pg_ctl -w -D /home/cener/ManageEngine/ServiceDesk/pgsql/data -o "-p65432" start ] 
  2. 27-feb-2024 15:53:28  [pglog]  [INFORMACIÓN] : su: atención: no se puede cambiar el directorio a /home/cener/ManageEngine/ServiceDesk/pgsql: Permiso denegado
  3. 27-feb-2024 15:53:28  [pglog]  [INFORMACIÓN] : -sh: 1: /home/cener/ManageEngine/ServiceDesk/pgsql/bin/pg_ctl: Permission denied
 cause
      For the successful startup of the PostgreSQL server, several files needs to be accessed such as files under "<product_installation_home>\pgsql". particularly  <product_installation_home>pgsql\data , <product_installation_home>\pgsql\ext_conf, <product_installation_home>\ tools folders. If the user who is trying to start the database is unable to access these files, then we could face the above exception.
      In the past cases we encountered, most of this issue is due to the invalid permissions configured for that particular user, which gets resolved after providing necessary permissions.
      Reference : SD-119253

resolution :
  1. Open a command prompt as the user, with whom you had installed the application. Or, with the user who you would like to start the application service. Or, with the user who you would like to invoke upgrade.
  2. Execute <product_installation_location> \ bin \ initPgsql script, 
  3. If the script executes without any issue, you can good to proceed with your required operation.
If you face any failures, ensure whether the permissions are configured in a proper way in your operating system. Some of the previously encountered cases, 

scenario 1 : If the permission denied error occurs when triggering an upgrade, but server starts successfully as service.
  1. The user configured with service is different from the user who triggered the upgrade in command prompt. The user configured in service has permission, whereas the user logged in to the command prompt doesn't. 
  2. You can resolve this by either try with the user who is running the service or providing proper permissions to the user who invoke the upgrade in command prompt.
scenario 2 : If you hosted the application in a Linux server, refer How to configure permissions for Postgresql Database in Linux?

Case 2 : Database/Server machine crash lead to corrupted Database
  1. Dec 21, 2023 2:45:10 PM  [com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer]  [INFO] : Command to be executed [C:\ManageEngine\ServiceDesk\pgsql\bin\pg_ctl.exe, -w, -D, C:\ManageEngine\ServiceDesk\pgsql\data, -o, "-p65432", start] 
  2. Dec 21, 2023 2:47:52 PM  [pglog]  [INFO] : 2023-12-21 14:47:52 +08[0]:[10704]:[1]FATAL:  could not create lock file "postmaster.pid": Permission denied
  3. Dec 21, 2023 2:48:20 PM  [pglog]  [INFO] : waiting for server to start............................................................... stopped waiting
  4. Dec 21, 2023 2:48:20 PM  [pglog]  [INFO] : pg_ctl: server did not start in time
cause : 
  1. Insufficient permissions for the user, to create a file under the <product_installation_location>\data directory. 
  2. If the server machine or database crashes, then the PostgreSQL exit process cannot be executed properly. This postmaster.pid is a file which is generated during postgres startup and cleaned up while shutting down the postgres server. Due to the server crash, this file cleanup doesn't completed, which indicates the database is unstable which needs to be checked in priority.
resolution :
  1. Please follow the resolution in the "case 1" and configure the permissions accordingly.
  2. check the logs, under <product_installation_location> \ pgsql \data \ pg_log folder. If the issue doesn't resolves even after this case, check whether the mentioned file is corrupted.  If corrupted, Reach our support with the above mentioned files and <product_installation_location> \ pgsql directory (downloadable).
Case 3 : Environmental Delay

  1. Dec 21, 2023 2:45:03 PM  [com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer]  [INFO] : Command to be executed [C:\ManageEngine\ServiceDesk\pgsql\bin\pg_ctl.exe, -w, -D, C:\ManageEngine\ServiceDesk\pgsql\data, -o, "-p65432", start] 
  2. Dec 21, 2023 2:46:03 PM  [pglog]  [INFO] : waiting for server to start............................................................... stopped waiting
  3. Dec 21, 2023 2:46:03 PM  [pglog]  [INFO] : pg_ctl: server did not start in time
cause :
  1. In this case, the PostgreSQL server startup is delayed due to the intervention of other processes such as Firewall / Antivirus / Windows Defender
resolution :
  1. We can resolve this issue by excluding <product_installation_folder> from the Antivirus/Windows Defender Intervention and For a safer side, ensuring no other process is running inside the <product_installation_folder> directory. 
  2. If possible, try disabling those defender processes temporarily. For more information, refer this KB for troubleshooting connectivity Issues.
check whether the database can be started after this operation. if it is started, then the environment and its running process is the root cause for this issue. The customer need to streamline so that, no other process interfere with the execution of our application processes.

case 4 : Unstable application Instance 
  1. Feb 23, 2024 9:26:51 AM  [com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer]  [INFO] : Command to be executed [D:\ManageEngine\ServiceDesk\pgsql\bin\pg_ctl.exe, -w, -D, D:\ManageEngine\ServiceDesk\pgsql\data, -o, "-p65432", start] 
  2. Feb 23, 2024 9:26:51 AM  [pglog]  [INFO] : The process tried to write to a nonexistent pipe.
  3. Feb 23, 2024 9:26:52 AM  [pglog]  [INFO] : program "postgres" was found by "D:/ManageEngine/ServiceDesk/pgsql/bin/pg_ctl.exe" but was not the same version as pg_ctl
cause :
  1. This issue is caused by unstable application instance, which may be affected by a upgrade failure and not properly reverted OR not properly restored setup OR mishandling of application files.
resolution :
  1. Initiate the manual backup from the application. Make a fresh instance in a different location and restore it properly.
  2. If in case of upgrade failure, revert the application properly and try starting the database.
case 5 : Library Conflicts 
  1. su: cannot open session: Module is unknown
cause :
  1. LD_LIBRARY conflict issue caused in Linux.
resolution : 
  1. Refer to this https://pitstop.manageengine.com/portal/en/kb/articles/su-cannot-open-session-module-is-unknown.

                  New to ADSelfService Plus?

                    • Related Articles

                    • How to resolve Connectivity issues with Postgresql Database from our product?

                      Log Traces Feb 20, 2024 6:40:00 PM [SYSERR] [INFO] : java.sql.SQLException: java.lang.Exception: Exception during getConnection from pool Exception occurred during get connection from datasource Nov 15, 2023 1:29:10 PM [SYSERR] [INFO] : Caused by: ...
                    • Installation and Startup Failure of Postgres Database in some Linux Distributions

                      Log Traces Jul 27, 2023 6:24:49 PM [SYSOUT] [INFO] : /home/sdpuser/ManageEngine/ServiceDesk/pgsql/bin/psql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory Root Cause libtinfo.so is a ...
                    • Linux - Startup issue

                      System Halted error message during startup (Fresh installation)  Error Trace : [16:36:59:243]|[04-15-2021]|[com.adventnet.db.adapter.postgres.DefaultPostgresDBInitializer]|[INFO]|[1]: ErrorStream ::: /opt/MSP/ServiceDeskPlus-MSP/pgsql/bin/psql: error ...
                    • Migration failure for Postgres Database with a blank space in it

                      Trace : \ManageEngine\ServiceDesk\Patch\AdventNet_ManageEngine_ServiceDesk_Plus-14.2.0-SP-1.0.0\SERVICEDESK\PreInstall\pg_migrate\pgsql_old\bin\pg_dumpall.exe", -U, postgres, -p, 65433, -h, 127.0.0.1, -r, -w, |, ...
                    • Error While connecting default Postgres Database

                      If you are getting the below error while connecting the postgresDB , please follow the steps below : Error : psql: FATAL: no pg_hba.conf entry for host “::1”, user “postgres”, database “servicedesk”,SSL off Please open pg_hba.conf under [ServiceDesk ...