Virtual machines appear as Invalid immediately after it is added to the inventory
search cancel

Virtual machines appear as Invalid immediately after it is added to the inventory

book

Article ID: 319463

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:
  • When adding a virtual machine to inventory, the virtual machine displays Invalid machine name
  • In the /var/log/hostd.log file, there are entries similar to:
    [YYYY-MM-DDTHH:MM:SS] [6E4C2B70 verbose 'Vmsvc'] Initializing registering virtual machine [153]: /vmfs/volumes/datastore/virtualmachinefolder/virtualmachine.vmx
    -->
    ...
    [YYYY-MM-DDTHH:MM:SS] [6E4C2B70 warning 'Vmsvc.vm:/vmfs/volumes/datastore/virtualmachinefolder/ virtualmachine.vmx'] CannotRetrieveCorefiles: VM is in an invalid state
    [YYYY-MM-DDTHH:MM:SS] [6E4C2B70 verbose 'Vmsvc.vm:/vmfs/volumes/datastore/virtualmachinefolder/ virtualmachine.vmx'] Get shared vigor fields translated error to vim.fault.GenericVmConfigFault
    [YYYY-MM-DDTHH:MM:SS] [6E4C2B70 info 'Vmsvc.vm:/vmfs/volumes/datastore/virtualmachinefolder/ virtualmachine.vmx'] Get shared vigor fields failed: vim.fault.GenericVmConfigFault
    [YYYY-MM-DDTHH:MM:SS] [6E4C2B70 verbose 'Vmsvc.vm:/vmfs/volumes/datastore/virtualmachinefolder/ virtualmachine.vmx'] Get shared vigor fields message: Valid values: high, normal, low or a number 0 or larger
    --> Shares specification (-1) is invalid.
    --> Valid values: high, normal, low or a number 0 or larger
    --> Shares specification (-1) is invalid.
    -->
    [YYYY-MM-DDTHH:MM:SS] [6E4C2B70 info 'Vmsvc.vm:/vmfs/volumes/datastore/virtualmachinefolder/ virtualmachine.vmx'] Error encountered while retrieving configuration. Marking configuration as invalid: vim.fault.GenericVmConfigFault

Environment

VMware vSphere ESXi 6.5.x
VMware vSphere ESXi 6.7.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x

Cause

This issue occurs when the virtual machine configuration file .vmx contains an invalid value for CPU or memory shares.

Resolution

To resolve this issue, verify and modify the sched.cpu.shares and/or sched.mem.shares values in the virtual machine configuration file (.vmx) as needed.
 
To verify and modify the sched.cpu.shares and/or sched.mem.shares value within the virtual machine configuration file:
  1. Remove the virtual machine from the host or the vCenter Server inventory.
  2. Log in to the host via an SSH connection as root.
  3. Navigate to the path of the virtual machine configuration file.vmx.
  4. Locate these lines within the virtual machine configuration file:
    sched.cpu.shares = -1
    sched.mem.shares = -1
    ...

  5. If one or both values contain a negative value, open the file using a text editor and set the values of these parameters to normal:
    Example:
    sched.cpu.shares = normal
    sched.mem.shares = normal
  6. Save and close the file.
  7. Add the virtual machine back to inventory.

Additional Information