Leapp preupgrade of Red Hat Satellite 6 fails on Old PostgreSQL data found in /var/lib/pgsql/data

Solution Verified - Updated

Environment

  • Red Hat Satellite 6
  • Red Hat Enterprise Linux 7 (being upgraded to 8)

Issue

  • Having Satellite 6 which has been gradually upgraded from 6.7 via all versions till Satellite 6.11.

  • Trying to upgrade the underlying RHEL from 7 to 8.

  • leapp preupgrade complains about "Old PostgreSQL data found in /var/lib/pgsql/data".

  • Is it safe to remove whole directory content?

  • Leapp Upgrade on client from RHEL 7.9 to RHEL 8.6 is failing with bellow error of Satellite PostgreSQL data migration :

    Risk Factor: high (inhibitor)
    Title: Satellite PostgreSQL data migration
    Summary: Your PostgreSQL data in /var/opt/rh/rh-postgresql12/lib/pgsql/data/ is currently on a dedicated 
    volume.
    PostgreSQL on RHEL8 expects the data to live in /var/lib/pgsql/data.
    You currently don't have enough free storage to move the data.
    Automatic moving cannot be performed.
    However, instead of moving the data over, you might want to consider manually adapting your mounts,
    so that the contents of /var/opt/rh/rh-postgresql12/lib/pgsql/data/ are available in /var/lib/pgsql/data.
    After the data has been moved to the new location, all databases will require a REINDEX.
    This will happen automatically during the first boot of the system.
    Key: 73b763edc6174e956a242f9e8a81fbd9a2eaac1d
    

Resolution

  • During the upgrade, the PostgreSQL data is moved from /var/opt/rh/rh-postgresql12/lib/pgsql/data/ to /var/lib/pgsql/data/. If these two paths reside on the same partition, no further action is required. If they reside on different partitions, ensure that there is enough space for the data to be copied over. You can move the PostgreSQL data on your own and the upgrade will skip this step if /var/opt/rh/rh-postgresql12/lib/pgsql/data/ does not exist.

  • The working directory on RHEL 8 satellite for PGSQL will be /var/lib/pgsql/data.

  • If you previously upgraded Satellite or Capsule from an earlier version, and the /var/lib/pgsql contained the PostgreSQL database content before the migration from PostgreSQL 9 to PostgreSQL 12 from the SCL, empty /var/lib/pgsql before proceeding.

  • It is safe (and required) to remove the whole content of /var/lib/pgsql

  • Perform below command to remediate the same:

    rm -rf /var/lib/pgsql/*  
    
  • Create an new File system /var/lib/pgsql of 20 GB size.

  • Now run the preupgrade again:

    leapp preupgrade
    

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

That directory contains PostgreSQL database content from Satellite 6.7, before it was migrated under /var/opt/rh/rh-postgresql12/lib/pgsql/. The original /var/lib/pgsql is not further used at all and its content can be safely removed.

Diagnostic Steps

leapp preupgrade failed with error:

============================================================
                     UPGRADE INHIBITED                      
============================================================

Upgrade has been inhibited due to the following problems:
    1. Inhibitor: Old PostgreSQL data found in /var/lib/pgsql/data
..
SBR
Product(s)
Components
Category

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.