Error "Exception occurred in postInstallHook" during vCenter patch due to lccm_lifecycle_state already present
search cancel

Error "Exception occurred in postInstallHook" during vCenter patch due to lccm_lifecycle_state already present

book

Article ID: 418657

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

When you attempt to patch or upgrade vCenter Server Appliance, the operation fails during the post-installation phase with the error message:

Installation Failed Exception occurred in postInstallHook for vcintegrity Patch. Please check the logs for more details. Take corrective action and then resume.

The patch operation fails specifically during the database schema upgrade phase for the vSphere Lifecycle Manager (vLCM) component. In /var/log/vmware/applmgmt/PatchRunner.log, you see the error:

Failed to upgrade database schema. return code: 204

The root cause is found in /var/log/vmware/applmgmt/update_microservice.log, which shows a PostgreSQL error when attempting to create a database type that already exists:

[DATABASE] Vdb::RunScript, SQL Exec Error: "ODBC error: (42710) - ERROR: type "lccm_lifecycle_state" already exists;
Error while executing the query" is returned when executing SQL statement "CREATE TYPE lccm_lifecycle_state AS ENUM (
    'POST_PROVISIONING',
    'POST_POWER_ON'
)"

This database inconsistency prevents the vcIntegrity patch hook from completing successfully, causing the entire vCenter patch or upgrade operation to fail. The vCenter Server remains on its current version and cannot be updated until the vLCM database is reset.

Additional symptoms reported:

  • Update operation fails when attempting to upgrade vCenter Server Appliance
  • Error occurs during the patching process via VAMI interface

Environment

vCenter Server 7.x and newer

Cause

During a vCenter Server patch or upgrade, the database schema upgrade process attempts to create new PostgreSQL database type objects in the vSphere Lifecycle Manager (vLCM) database. The upgrade script executes SQL statements to define these types, including the lccm_lifecycle_state enum type used to track lifecycle states during patching operations.

When the schema upgrade script attempts to create the lccm_lifecycle_state type, PostgreSQL returns SQLSTATE error code 42710, indicating that this database type object already exists. This prevents the CREATE TYPE statement from completing successfully. The failure cascades through the vcIntegrity component, which returns error code 204 to indicate the database schema upgrade failed, and ultimately causes the entire patch operation to terminate.

This condition most commonly occurs after a previous incomplete or failed patch attempt that partially created database objects without completing the full schema upgrade. The database type remains in the vLCM database from the incomplete operation, but the overall schema upgrade process did not complete successfully. When you retry the patch operation, the upgrade script attempts to create the same type again, encountering the duplicate object error.

This issue is more likely to occur when:

  • A previous vCenter patch or upgrade attempt failed or was interrupted
  • The patch involves schema changes to the vLCM database (not all patches modify the database schema)

Resolution

Note: Resetting the vLCM database removes custom baselines, custom images, and NSX VIBs. You will need to recreate any custom baselines or images after the resolution is complete.


Important: Before proceeding, create a powered-off snapshot of the vCenter Server VM to provide a rollback point:

  1. Connect to the ESXi host managing the vCenter Server VM using the direct host UI (https://esxi-host-ip/ui)
  2. Power off the vCenter Server VM
  3. Right-click the vCenter Server VM and select Snapshots > Take Snapshot
  4. Power on the vCenter Server VM

To resolve this issue, reset the vSphere Lifecycle Manager database:

  1. Connect to the vCenter Server Appliance via SSH as root
  2. Stop the Update Manager service:
    service-control --stop vmware-updatemgr
    
  3. Reset the vLCM database by running both of the following commands:
    python /usr/lib/vmware-updatemgr/bin/updatemgr-utility.py reset-db
    
  4. Clear the patch store:
    rm -rf /storage/updatemgr/patch-store/*
    
  5. Start the Update Manager service:
    service-control --start vmware-updatemgr
    
  6. Retry the vCenter Server patch or upgrade operation from the VAMI interface (https://vcenter-ip:5480)

If NSX-T is deployed in your environment (vCenter Server 7.0 U1 and later):

After completing the database reset, the NSX depot must be re-uploaded to vCenter. Follow Resetting the VMware Update Manager Database

Post-resolution verification:

After successfully completing the steps, the patch upgrade should succeed.

Additional Information

Identifying this issue before attempting a patch:

You can check for this specific database condition by examining the log files from a previous failed patch attempt:

grep -i "Failed to upgrade database schema. return code: 204" /var/log/vmware/applmgmt/PatchRunner.log

To check for the specific database type error:

grep -E "(lccm_lifecycle_state already exists|SQLState='42710')" /var/log/vmware/applmgmt/update_microservice.log 

Log file locations:

The key error messages for this issue are found in:

  • /var/log/vmware/applmgmt/PatchRunner.log - Contains the vcIntegrity patch failure and return code 204
  • /var/log/vmware/applmgmt/update_microservice.log - Contains the PostgreSQL SQLSTATE 42710 error showing which database type already exists

Related information:

For information about resetting the vLCM database and NSX-T recovery procedures, see Resetting the VMware Update Manager Database

For a different database schema upgrade issue involving the amcheck_next extension, see Upgrade or Patching to vCenter 7.0 Update 2 or later fails during vPostgres upgrade when amcheck_next extension is present in vCenter Database