Upgrade of vCenter fails with ERROR: insert or update on table "vpx_sn_virtual_disk" violates foreign key constraint "fk_vpx_sn_virtual_disk"
search cancel

Upgrade of vCenter fails with ERROR: insert or update on table "vpx_sn_virtual_disk" violates foreign key constraint "fk_vpx_sn_virtual_disk"

book

Article ID: 319693

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Symptoms:
  • Windows vCenter Server upgrade from 6.0 U3 to 6.5  U2d fails with the error: "installation of vcsservicemanager failed 1603 "
  • In the vminst.log file, you see entries similar to:

2019-04-30 10:33:26.134+02:00| vcsInstUtil-10964411| I: ParseStatusFile: curr error msg: "Encountered an internal error. see
C:\ProgramData\VMware\vCenterServer\logs\firstboot\vpostgresfirstboot.py_13644_stderr.log"
2019-04-30 10:33:26.134+02:00| vcsInstUtil-10964411| E: ParseStatusFile: Displaying error message for "VMware vCenter Server": "Encountered an internal error.see C:\ProgramData\VMware\vCenterServer\logs\firstboot\vpostgres-firstboot.py_13644_stderr.log"
    This is an unrecoverable error, please retry install. If you encounter this error again, please search for these symptoms in the VMware Knowledge Base for any known issues and possible resolutions. If none can be found, collect a support bundle and open a support request."
    
    
    2019-04-30 10:44:02.664+02:00| vcsInstUtil-10964411| E: wWinMain: MSI result of install of "F:\vCenter-Server\Packages\vcsservicemanager.msi" may have failed: 1603 (0x00000643)
    2019-04-30 10:44:02.669+02:00| vcsInstUtil-10964411| E: LaunchPkgMgr: Operation on vcsservicemanager.msi appears to have failed: 1603 (0x00000643)
    2019-04-30 10:44:02.675+02:00| vcsInstUtil-10964411| I: PitCA_MessageBox: Displaying message: "Installation of component VCSServiceManager failed with error code '1603'. Check the logs for more details."^M
 
  • In the ProgramData/VMware/vCenterServer/logs/vmware-vpx/vcdb_import.err , you can see the below entries:

    psql:C:/ProgramData/VMware/vCenterServer/export/vcdb/create_constr.sql:976: ERROR:  insert or update on table "vpx_sn_virtual_disk" violates foreign key constraint "fk_vpx_sn_virtual_disk"
    DETAIL:  Key (vdevice_id)=(80139) is not present in table "vpx_sn_virtual_device".
    scades to constraint fk_fle_disk_unit_ref_dl on table vpx_vm_fle_disk_unit


Environment

VMware vCenter Server 6.0.x
VMware vCenter Server 6.5.x

Cause

  • This is due to certain orphaned data present in the table "vpx_sn_virtual_disk". 
 

Resolution

  • Run the below query to confirm 
select count(*) from vpx_sn_virtual_disk where vdevice_id not in (select vdevice_id from vpx_sn_virtual_device); 

This query will give you the count of entries in table "vpx_sn_virtual_disk" whose vdevice_id is not present in table "vpx_sn_virtual_device"
  • If the output is non-zero, proceed to delete the record. 

Note: Before making any changes in the database, make sure that you have a valid database back up in place.
  • Run the below query to do so:
delete from vpx_sn_virtual_disk where vdevice_id not in (select vdevice_id from vpx_sn_virtual_device);