VCSA patching via VAMI fails with "OSError: [Errno 8] Exec format error: '/opt/vmware/vpostgres/current/bin/psql'" during pre-check
search cancel

VCSA patching via VAMI fails with "OSError: [Errno 8] Exec format error: '/opt/vmware/vpostgres/current/bin/psql'" during pre-check

book

Article ID: 344949

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Symptoms:

  • vCenter Server Appliance (VCSA) patching pre-check via VAMI returns "Internal error occurs during execution of update process"
  • Execution of the command to access the VCSA database (vcdb) works fine via ssh/shell
  • /var/log/vmware/applmgmt/PatchRunner.log
[YYYY-MM-DDTHH:MM:SS] vcIntegrity:CollectRequirements INFO vcIntegrity VMware Update Manager started host validation.
[YYYY-MM-DDTHH:MM:SS] vcIntegrity:CollectRequirements INFO vcIntegrity Executing command: /opt/vmware/vpostgres/current/bin/psql -d VCDB -U postgres -q -t -c SELECT vpx_entity.name FROM vpx_entity JOIN vpx_host ON vpx_entity.id=vpx_host.id WHERE vpx_host.product_build IN ('18644231', '18825058', '18792741', '18831705', '18934053', '18935636', '18801418', '18733601', '19037457', '19063458')
[YYYY-MM-DDTHH:MM:SS] vcIntegrity:CollectRequirements WARNING transport.local BAD REQUEST: Cannot execute ['/opt/vmware/vpostgres/current/bin/psql', '-d', 'VCDB', '-U', 'postgres', '-q', '-t', '-c', "SELECT vpx_entity.name FROM vpx_entity JOIN vpx_host ON vpx_entity.id=vpx_host.id WHERE vpx_host.product_build IN ('18644231', '18825058', '18792741', '18831705', '18934053', '18935636', '18801418', '18733601', '19037457', '19063458')"]. Error: [Errno 8] Exec format error: '/opt/vmware/vpostgres/current/bin/psql'
[YYYY-MM-DDTHH:MM:SS] vcIntegrity:CollectRequirements ERROR vmware_b2b.patching.executor.hook_executor Patch hook 'vcIntegrity:CollectRequirements' failed.
Traceback (most recent call last):
  File "/storage/core/software-update/updates/7.0.3.01500/scripts/patches/libs/sdk/transport/local.py", line 479, in startProcess
    creationflags=creationflags)
  File "/usr/lib/python3.7/subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "/usr/lib/python3.7/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 8] Exec format error: '/opt/vmware/vpostgres/current/bin/psql'

 

Environment

VMware vCenter Server 7.0.x
VMware vCenter Server 8.0.x

Cause

This issue is caused due to sharp-exclamation (#!) parameter missing at the beginning of the script

Resolution

In order to resolve the issue, implement the below steps

  • Log in to the VCSA via ssh
  • Navigate to the script location using the below command
cd /opt/vmware/vpostgres/current/bin/
  • Execute the below command to append the sharp-exclamation on the file
sed -i '1 i\#!/bin/sh' psql
  • Proceed with patching of the VCSA