Image compliance scan fails during the vSphere Lifecycle Manager (vLCM) compliance check - "Error: com.vmware.vapi.std.errors.not_allowed_in_current_state Messages: com.vmware.esx.task.contention"
search cancel

Image compliance scan fails during the vSphere Lifecycle Manager (vLCM) compliance check - "Error: com.vmware.vapi.std.errors.not_allowed_in_current_state Messages: com.vmware.esx.task.contention"

book

Article ID: 451408

calendar_today

Updated On:

Products

VMware vSphere ESXi VMware vCenter Server

Issue/Introduction

  • In the vCenter UI, the image compliance scan fails with a "Host status is unknown" message and generates the following error:

    A failure occurred when starting a host compliance check operation on host <HOST FQDN>: Error: com.vmware.vapi.std.errors.not_allowed_in_current_state Messages: com.vmware.esx.task.contention<Another task is in progress. Please retry later.>

  • The vCenter /var/log/vmware/vmware-updatemgr/vum-server/vmware-vum-server.log  reports an error similar to the following:

    info vmware-vum-server[######] [Originator@6876 sub=Telemetry opID=########-####-####-####-############] [TelemetryManager ###] Sending telemetry data: {"@type":"pmanerrorreport","taskId":"########-####-####-####-############|########-####-####-####-############","entityId":"########-####-####-####-############|host-[MASKED MOID]","parentTaskId":"","errorMessageId":"com.vmware.vcIntegrity.lifecycle.HostScan.TaskApiError","errorMessage":"A failure occurred when starting a host compliance check operation on host '[FQDN]' : Error:\n   com.vmware.vapi.std.errors.notallowedincurrentstate\nMessages:\n   com.vmware.esx.task.contention\n","errorTime":"YYYY-MM-DDTHH:MM:SS"}

  • The host /var/run/log/settingsd.log reports that there is a sync file which is causing an error:

    Er(##) settingsd[########]: error [ConfigStore:########### opId=####################################] [CheckTaskContention]: Task sync file exists and contains 'PRECURSOR: ########-####-####-####-############', 2 retries left

  • The host /var/vmware/lifecycle/lifecycle.task reports a 'PRECURSOR' task. The following is an example:

PRECURSOR: <########-####-####-####-############>

  • Running the following commands against the host /var/vmware/lifecycle/task-status.json.db file returns the details of a software scan that has not completed:

/usr/lib/vmware/sqlite/bin/sqlite3 task-status.json.db
SQLite version 3.34.1 YYYY-MM-DD HH:MM:SS
Enter ".help" for usage hints.
sqlite> SELECT * from tasks where task_id='<########-####-####-####-############>';
<########-####-####-####-############>|com.vmware.esx.settingsdaemon.software.scan||RUNNING|YYYY-MM-DDTHH:MM:SS|YYYY-MM-DDTHH:MM:SS|YYYY-MM-DDTHH:MM:SS||0|100||||[]

Environment

  • VMware vSphere ESXi 8.x
  • VMware vCenter Server 8.x
  • VMware vSphere ESX 9.x
  • VMware vCenter 9.x

Cause

The vLCM/Image Compliance scan is failing on each ESXi host because vCenter determines that the hosts are already executing another task when vCenter attempts to initiate the scan. This is due to a stale scan process on the local host's lifecycle DB which never completes.

Resolution

  1. On each host, move the following files to a new directory: lifecycle.task, task-status.json, and task-status.json.db.

    mv /var/vmware/lifecycle/lifecycle.task /<NEW DIRECTORY NAME>
    mv /var/vmware/lifecycle/task-status.json /<NEW DIRECTORY NAME>
    mv /var/vmware/lifecycle/task-status.json.db /<NEW DIRECTORY NAME>

  2. Restart the settingsd service on each of the hosts:

    /etc/init.d/settingsd restart

  3. Run a compliance scan to see if it is successful for that host.

Additional Information

List of similar KBs with different causes and resolutions: