Monday, 22 February 2016

vCenter Appliance upgrade to 6.0 fails with "Internal error occurs during VMware vCenter Server Database pre-upgrade checks"

Written by Suhas Savkoor



Today while upgrading vCenter appliance from 5.1 U3 to 6.0, it failed with the error:

Error: Internal error occurs during VMware vCenter Server Database pre-upgrade checks

Upon checking the log file, CollectRequirements_com.vmware.vcdb_date.log file, this is what I came across:

2016-02-20T19:37:44.353Z INFO vcdb Retrieving DB type...
2016-02-20T19:37:44.353Z INFO vcdb DB type retrieved: PostgreSQL
2016-02-20T19:37:44.366Z INFO vcdb Retrieving DB user...
2016-02-20T19:37:44.395Z INFO vcdb DB user retrieved: vc
2016-02-20T19:37:44.407Z INFO vcdb Retrieving DB password...
2016-02-20T19:37:44.433Z INFO vcdb DB password retrieved: ****
2016-02-20T19:37:44.456Z INFO vcdb Validating source embedded schema...
2016-02-20T19:38:00.481Z INFO vcdb Souce embedded schema validation completed.
2016-02-20T19:38:00.498Z WARNING transport.local BAD REQUEST: Cannot execute ['/opt/vmware/vpostgres/1.0/bin/psql', '-U', 'postgres', '-d', 'VCDB', '-t', '-c', "\n SELECT ceil(sum(pg_relation_size(C.oid)) / (1024*1024)) as disk_size\n FROM pg_class C\n LEFT JOIN pg_namespace N\n ON N.oid = C.relnamespace\n WHERE nspname IN ('vc', 'vpx') and relkind in ('r', 't')\n \n AND relname NOT LIKE 'vpx_hist_stat%'\n AND relname NOT LIKE 'vpx_sample_time%'\n AND relname NOT LIKE 'vpx_event%'\n AND relname NOT LIKE 'vpx_task%'\n AND relname NOT LIKE 'vpx_property_bulletin%'\n "]. Error: [Errno 2] No such file or directory
2016-02-20T19:38:00.498Z ERROR __main__ Upgrade Phase 'vcdb:CollectRequirements' failed. Exception: Traceback (most recent call last): File "/var/tmp/vmware-upgrade-requirements/cis-upgrade-runner/payload/componentPhaseLauncher.py", line 379, in main executionResult = systemExtension(exeContext)

The reference it makes to while saying, Cannot execute is /opt/vmware/vpostgres/1.0/bin/psql

Now, when you run:
ls -l /opt/vmware/vpostgres/1.0/
You see:
total 8
drwxr-xr-x 2 root root 4096 Jan 4 2016 lib
drwxr-xr-x 5 root root 4096 Jan 4 2016 shar

There is no directory called bin under 1.0

When you run:
ls -l /opt/vmware/vpostgres/
You see:
drwxr-xr-x 4 root root 4096 Jan 4 2016 1.0
drwxr-xr-x 7 root root 4096 Jan 4 2016 9.0
lrwxrwxrwx 1 root root 3 Jan 4 2016 current -> 9.0

So, the execution python script is calling a wrong path causing a failure in the upgrade. VMware should fix this call in their python script.

You can address this by creating a symbolic link to the correct path by running the below command:
"ln -s /opt/vmware/vpostgres/current/bin /opt/vmware/vpostgres/1.0/bin" 
Run the upgrade again and this time there should be no issues.

Cheers!