Troubleshooting issues with VMs or datastore names containing special characters
search cancel

Troubleshooting issues with VMs or datastore names containing special characters

book

Article ID: 323189

calendar_today

Updated On:

Products

VMware vCenter Server VMware vSphere ESXi

Issue/Introduction

  • After migrating or registering a virtual machine (VM) in vCenter, the VM appears as "Invalid" in the inventory. Attempting to power on the VM fails with the error: "Failed to start the virtual machine (error -18)."

  • In the ESXi /var/run/log/hostd.log file, you may observe an error indicating a path parsing failure, similar to below:

    Expected permission (3) for /vmfs/volumes/[datastore_path]/[vm_directory_name] not found in domain [X]

    And subsequently:

    Cannot open the configuration file /vmfs/volumes/[datastore_path]/[vm_directory_name]/[vm_name].vmx: Error.

  • In the /var/log/syslog.log file, you see entries similar to:

    <YYY-MM-DDTHH:MM:SS>,426 Host Profiles[41776]: ERROR: Exception while retrieving profile. Exception: Failed to evaluate output of command ['storage', 'core', 'device', 'list']. Error: invalid syntax

    <YYY-MM-DDTHH:MM:SS>,426 Host Profiles[41776]: WARNING: excObj is unknown type

    <YYY-MM-DDTHH:MM:SS>Z HostProfileManager: [<YYY-MM-DDTHH:MM:SS>,429 root ERROR] Traceback (most recent call last):

    File "/build/mts/release/bora-1331820/bora/build/esx/release/vmvisor/sys/lib/python2.6/site-packages/SoapHandler.py", line 1351, in _InvokeMethod

    File "/build/mts/release/bora-1331820/bora/build/esx/release/vmvisor/sys/lib/python2.6/site-packages/pyVmomi/VmomiSupport.py", line 351, in _InvokeMethod

    File "/build/mts/release/bora-1331820/bora/build/esx/release/vmvisor/sys/lib/python2.6/site-packages/SoapHandler.py", line 225, in InvokeMethod

    File "/build/mts/release/bora-1331820/bora/build/esx/release/vmvisor/sys/lib/python2.6/site-packages/hostprofiles/pyEngine/hostprofilemanager.py", line 363, in RetrieveProfile

    File "/build/mts/release/bora-1331820/bora/build/esx/release/vmvisor/sys/lib/python2.6/site-packages/hostprofiles/pyEngine/hputil.py", line 747, in ProcessException

    vmodl

    <YYY-MM-DDTHH:MM:SS>Z HostProfileManager: .fault.SystemError: (vmodl.fault.SystemError) {

    dynamicType = <unset>,

    dynamicProperty = (vmodl.DynamicProperty) [],

    msg = <unset>,

    faultCause = <unset>,

    faultMessage = (vmodl.LocalizableMessage) [

    (LocalizableMessageWithPath) {

    dynamicType = <unset>,

    dynamicProperty = (vmodl.DynamicProperty) [],

    key = 'com.vmware.vim.profile.engine.UnexpectedError',

    arg = (vmodl.KeyAnyValue) [

    (vmodl.KeyAnyValue) {

    dynamicType = <unset>,

    dynamicProperty = (vmodl.DynamicProperty) [],

    key = 'context',

    value = 'Exception while retrieving profile'

    },

    (vmodl.KeyAnyValue) {

    dynamicType = <unset>,

    dynamicProperty = (vmodl.DynamicProperty) [],

    key = 'error',

    value = 'Failed to evaluate output of command'


    Note: This log excerpt is an example. Date, time, and environmental variables may vary depending on your environment.

 

Environment

VMware vCenter Server 7.x
VMware vCenter Server 8.x
VMware vSphere ESXi 7.x
VMware vSphere ESXi 8.x

Cause

vCenter Server and ESX/ESXi server do not escape special characters used in the display names.
 
For example, if a virtual machine name contains the % character, it does not escape the character. This causes issues when querying for the name from vSphere Web Client or using the SDK.
 
This issue is seen when special characters like %, &, *, $, #, @, !, \, /, :, *, ?, ", <, >, |, ;, [, ] ' etc are contained in names of vSphere entities such as virtual machine name, cluster name, and datastore/folder/file name.

Resolution

To resolve this issue, avoid using special characters in the names. You must sanitise the directory path by removing the special characters. The same can be addressed by renaming the Virtual Machine manually. Follow the steps below:

  1. If the VM is currently registered in vCenter, remove it from the inventory. Important: Do not delete the files from disk.
  2. Navigate to the datastore via the vSphere Client or command line (ls -l /vmfs/volumes/).
  3. Locate the directory name containing the VM files which includes special characters (e.g., test_*vm).
  4. Rename the Virtual Machine directory and all the files inside the folder to remove all special characters (e.g., rename test_*vm to test_vm).
  5. Ensure the new name uses only alphanumeric characters, underscores, or hyphens.
  6. In the Datastore Browser, locate the renamed directory.
  7. Right-click the .vmx file and select Register VM.
  8. Attempt to power on the Virtual Machine in the vSphere Client. The same should now power on successfully, as the path resolution failure has been resolved.

Additional Information

When the VM is powered on for the first time after the rename, a question may be raised about whether the VM has been moved of copied. This question would pause power-on for up to 4 minutes or until it is answered. Refer the following kb on this behaviour- Answering a virtual machine related question from the command line