PostgreSQL Service Failing to Start on Red Hat Capsule Server after performing Leapp Upgrade from RHEL 7 to RHEL 8

Solution Verified - Updated

Environment

  • Red Hat Satellite 6.11
  • Red Hat Enterprise Linux 8.6

Issue

  • Failed to start PostgreSQL database server after upgrading RHEL OS from 7 to 8.

  • Leapp upgrade completed but PostgreSQL service failing to start.

        Jan 27 18:49:21 capsule.example.com systemd[1]: Starting PostgreSQL database server...
    Jan 27 18:49:21 capsule.example.com postmaster[13737]: 2023-01-27 18:49:21.903 GMT [13737] LOG:  skipping missing configuration file "/var/opt/rh/rh-postgresql12/lib/pgsql/data/postgresql.auto.conf"
    Jan 27 18:49:21 capsule.example.com postmaster[13737]: 2023-01-27 18:49:21 UTC FATAL:  "/var/opt/rh/rh-postgresql12/lib/pgsql/data" is not a valid data directory
    Jan 27 18:49:21 capsule.example.com postmaster[13737]: 2023-01-27 18:49:21 UTC DETAIL:  File "/var/opt/rh/rh-postgresql12/lib/pgsql/data/PG_VERSION" is missing.
    Jan 27 18:49:21 capsule.example.com systemd[1]: postgresql.service: Main process exited, code=exited, status=1/FAILURE
    Jan 27 18:49:21 capsule.example.com systemd[1]: postgresql.service: Failed with result 'exit-code'.
    Jan 27 18:49:21 capsule.example.com systemd[1]: Failed to start PostgreSQL database server.
    
  • The postgresql.conf file pointing to the old PostgreSQL data directory, whereas it should be /var/lib/pgsql/data, how to correct it?

     port = 5432
     data_directory = '/var/opt/rh/rh-postgresql12/lib/pgsql/data'
    

Resolution

  • Re-run the satellite-installer on the External Red Hat capsule server to correct the configuration files and services.

        # satellite-installer --scenario capsule
    
        # satellite-maintain service restart 
    
        # satellite-maintain service status -b
    
        # foreman-maintain health check
    
  • For more KB articles/solutions related to Red Hat Satellite 6.x LEAPP Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x LEAPP Issues

Root Cause

  • The postgresql.conf file was pointing to the old PostgreSQL data directory, whereas it supposes to have an entry of /var/lib/pgsql/data.
  • In RHEL 7 PostgreSQL uses /var/opt/rh/rh-postgresql12/lib/pgsql/data but in RHEL 8 it uses /var/lib/pgsql/data

Diagnostic Steps

  • Leapp upgrade will show such an error if it is failing to cpmplete the task, in `/var/log/leapp/leapp-upgrade.log.

     2023-01-27 16:46:01.563 DEBUG    PID: 8033 leapp.workflow.FirstBoot.satellite_upgrader:   There were errors detected during install.
     2023-01-27 16:46:01.570 DEBUG    PID: 8033 leapp.workflow.FirstBoot.satellite_upgrader:   Please address the errors and re-run the installer to ensure the system is properly configured.
     2023-01-27 16:46:01.576 DEBUG    PID: 8033 leapp.workflow.FirstBoot.satellite_upgrader:   Failing to do so is likely to result in broken functionality.
     2023-01-27 16:46:01.581 DEBUG    PID: 8033 leapp.workflow.FirstBoot.satellite_upgrader: 
     2023-01-27 16:46:01.586 DEBUG    PID: 8033 leapp.workflow.FirstBoot.satellite_upgrader:   The full log is at /var/log/foreman-installer/capsule.log
    
  • Verify the Red Hat Capsule services by using below command

      # satellite-maintain service status -b
    
  • To verify the particular service status, like PostgreSQL use below command.

     # systemctl status postgresql.service 
    
SBR
Product(s)
Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.