vCenter Patching failed with message "Exception occurred in install precheck phase"
/var/log/vmware/applmgmt/Patchrunner.log
####-##-##T##:##:##.###Z vmdir:Validation INFO vmdir Vmdir validation Hook Called
####-##-##T##:##:##.###Z vmdir:Validation INFO vmdir.utils Running command: ['/opt/likewise/bin/lwregshell', 'list_values', '[HKEY_THIS_MACHINE\\Services\\vmdir]']
2024-07-31 05:56:45,971.971Z vmdir:Validation ERROR vmware_b2b.patching.executor.hook_executor Patch hook 'vmdir:Validation' failed.
Traceback (most recent call last):
File "/storage/core/software-update4i3wf_m1/stage/scripts/patches/py/vmware_b2b/patching/executor/hook_executor.py", line 74, in executeHook
executionResult = systemExtension(args)
File "/storage/core/software-update4i3wf_m1/stage/scripts/patches/libs/sdk/extensions.py", line 106, in __call__
result = self.extension(*args)
File "/storage/core/software-update4i3wf_m1/stage/scripts/patches/libs/sdk/extensions.py", line 123, in _func
return func(*args)
File "/storage/core/software-update4i3wf_m1/stage/scripts/patches/payload/components-script/vmdir/__init__.py", line 108, in validate
dcAccount, passwordval = util.getMachineCredentials()
File "/storage/core/software-update4i3wf_m1/stage/scripts/patches/payload/components-script/vmdir/utils.py", line 324, in getMachineCredentials
(rc, stdout, stderr) = self.run_command_with_display(cmd, cmd)
File "/storage/core/software-update4i3wf_m1/stage/scripts/patches/payload/components-script/vmdir/utils.py", line 236, in run_command_with_display
return self._run_command(cmd, stdin)
File "/storage/core/software-update4i3wf_m1/stage/scripts/patches/payload/components-script/vmdir/utils.py", line 209, in _run_command
stdin=subprocess.PIPE)
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/likewise/bin/lwregshell'
VMware vCenter Server
[Errno 8] Exec format error when there are invalid contents or no contents in the file
From the above, the issue is specific to /opt/likewise/bin/lwregshell file
Note : Before making any changes to files, make sure you have offline snapshot best practices and backups.
1. Change the directory to /opt/likewise/bin/
cd /opt/likewise/bin/
2. Validate the filesize of lwregshell using 'ls -ltrh lwregshell'
(Without quotes)
3. If the file size is listed as 0 bytes, there are no executable format in script.
4. Copy the lwregshell file from working vCenter server and Replace it in problematic vCenter server of same version and build.
5. After replacing this file, modify permissions on copied file using below command: chmod 755 lwregshell
6. Restart all vCenter services using 'service-control --stop --all && service-control --start all'
7. Proceed to perform the patch cleanup and attempt patching again.
Permissions can be viewed by ls -ltrh on exisiting file and assign the permissions accordingly:
root@vcsa [ /opt/likewise/bin ]# ls -ltrh *lwregshell*
-rwxr-xr-x 1 root root 443K Apr 21 2022 lwregshell
root@vcsa [ /opt/likewise/bin ]#