Red Hat Satellite upgrade fails with following error: Error DB_VERSION_MISMATCH: Database environment version mismatch

Solution Verified - Updated -

Environment

  • Red Hat Satellite 6
  • Red Hat Enterprise Linux 8

Issue

  • Satellite Server upgrade process fails with the following error:

    2024-08-20 18:04:45 [ERROR ] [configure] /Stage[main]/Postgresql::Server::Contrib/Package[postgresql- 
    contrib]/ensure: change from 'purged' to 'present' failed: Execution of '/bin/dnf -d 0 -e 1 -y install 
    postgresql-contrib' returned 1: RPM: error: db5 error(-30969) from dbenv->open: BDB0091 
    DB_VERSION_MISMATCH: Database environment version mismatch
    2024-08-20 18:04:45 [ERROR ] [configure] RPM: error: cannot open Packages index using db5 -  (-30969)
    2024-08-20 18:04:45 [ERROR ] [configure] RPM: error: cannot open Packages database in /var/lib/rpm
    

Resolution

  • Take a backup of the existing RPM database using the steps outlined in the following KCS article:

  • Rebuild the RPM database using the steps outlined in the following KCS article:

  • If the above RPM rebuild has been successful, continue with the Satellite upgrade which failed earlier. Use the required target version in below commands:

    # satellite-maintain upgrade check
    # satellite-maintain upgrade run 
    

Root Cause

  • The error is due to the RHEL database files being corrupted while the upgrade tool tries to access them. Rebuilding the database allows the Satellite tool to continue the upgrade

Diagnostic Steps

  • The following error can be found in /var/log/foreman-installer/satellite.log during the Satellite upgrade:

    /Stage[main]/Postgresql::Server::Contrib/Package[postgresql-contrib]/ensure
    change from 'purged' to 'present' failed: Execution of '/bin/dnf -d 0 -e 1 -y install postgresql-contrib' 
    returned 1: RPM: error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database
    environment version mismatch
    RPM: error: cannot open Packages index using db5 -  (-30969)
    RPM: error: cannot open Packages database in /var/lib/rpm
    Error: Could not run transaction.
    
    1 error was detected during installation.
    Please address the errors and re-run the installer to ensure the system is properly configured.
    Failing to do so is likely to result in broken functionality.
    

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.

Comments