"Invalid Configuration for Device 0" error powering on / Cloning virtual machine
search cancel

"Invalid Configuration for Device 0" error powering on / Cloning virtual machine

book

Article ID: 339996

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

Symptoms:
  • Cloning a powered on virtual machine from one data center to another fails with the error message:

    Unable to find device or file / Failed to clone a VM, error: Invalid configuration for device "0"
  • A virtual machine not powered down during a datastore re-signature fails with the error message:

    Invalid Configuration for Device 0
  • Cannot connect a virtual machine's virtual NIC (vNIC) to a vSphere Distributed Switch (vDS) portgroup after performing a vMotion.
  • Trying to connect the vNIC to a vDS portgroup after migration to the new ESXi host fails.
  • In the /var/log/ hostd.log file, you see the entries similar to:

    <YYYY-MM-DD>T<time>.783Z [39282B70 verbose 'Hostsvc.NetworkProvider' opID=16d8c9f2-e3 user=vpxuser] DVPort 542 on dvs b0 1a 38 50 b0 05 61 04-2a ad 48 5e 55 ae 51 5a not found
    <YYYY-MM-DD>T<time></time>.783Z [39282B70 error 'Vmsvc.vm:/vmfs/volumes/547e2d16-3f592880-f6ae-0025b3a4b008/VM Folder/VM Name.vmx' opID=16d8c9f2-e3 user=vpxuser] Device spec doesn't match up with dvport/dvpg configuration
    </time>

    Note: The preceding log excerpts are only examples. Date, time, and environmental variables may vary depending on your environment.


Environment

VMware vSphere ESXi 6.0
VMware vSphere ESXi 6.5
VMware vSphere ESXi 6.7

Cause

This issue may occur for one of the following reasons:
  • If virtual machine configuration differs from the vCenter Server database records for the virtual machine.
  • If an invalid port group is selected for one of the network cards in the virtual machine.
  • If the temporary disks created during the clone operation (which are not physically present) are not removed after the operation.

    For example, if you have two hard disks in the original virtual machine, on the new virtual machine you may have one additional disk which is unavailable if viewing from the Edit Settings screen for the virtual machine in the VI Client or vSphere Client.
 
  • When the vCenter Server database does not match the virtual machine settings.
  • Cloning  operation fails at 99%  or Cloning the virtual machine fails with the error:
    Failed to clone a VM, error: Invalid configuration for device "0"
     

Resolution

Scenario 1 - An invalid port group selection
 
To resolve this issue, ensure that a valid port group is selected for the network cards of a virtual machine.
 
  1. Connect vSphere Client to the vCenter Server.
  2. Right-click the virtual machine and select Edit Settings.
  3. Select the Network Card and change the Port Group settings to a different Port Group and click OK.
  4. Change the Port Group of the virtual machine back to the original Port Group and click OK.
Note: "Invalid configuration for device '0'" error when re-connecting VM's network adapter

 
Scenario 2 - Disks created during clone operations
 
To resolve this issue, manually remove the temporary disk entries from the .vmx configuration file.

To remove the additional disk:
  1. Run this command to determine the path of the virtual machine and .vmx file name:

    vim-cmd /vmsvc/getallvms
  2. Navigate to the virtual machine folder found from output of step 1.

    For example:


    cd /vmfs/volumes/mydatastore/myvm
     
  3. Backup the .vmx file before making any changes by running the command:

    cp myvm.vmx /backup_path
     
  4. Open the .vmx file in a text editor. For more information, see Editing files on an ESX host using vi or nano (1020302) .
  5. Locate the scsi0:x.present = "TRUE" line and change it to scsi0:x.present = "FALSE" for the additional virtual disk causing the error.

    Example:

    After editing, the entries look similar to:


    scsi0:1.present = "FALSE"
    scsi0:1.fileName = "myvm.vmdk"
    scsi0:1.deviceType = "scsi-hardDisk"
    scsi0:1.redo = ""

     
  6. Save the changes to the .vmx file and exit the text editor.
  7. For these changes to take effect in vCenter Server, right-click the virtual machine and click Remove from Inventory.
  8. Re-register the virtual machine by running this command:

    In ESX/ESXi 4.x:


    vmware-cmd -s register /vmfs/volumes/mydatastore/myvm/myvm.vmx

    ESXi 5.x onward:

    vim-cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmx

    Note: To reload the virtual machine's .vmx file without removing it from inventory, see Reloading a vmx file without removing the Virtual machine from inventory (1026043) .
     
  9. Right-click the virtual machine in the vSphere Client and click Edit settings. Verify that the offending disk is not available. You can then switch the controller value for the existing disk to 0:1 to achieve consistency.
  10. If any virtual machines are observed with question marks, power on and select the virtual machine and click the Summary tab.
  11. If you are prompted to create new uuid (or copy it if you are using the vSphere Client), click Yes.

    The virtual machine will now power on without the errors or question mark.

Scenario 3 - Cloning a virtual machine fails 
 
Error:  Failed to clone a VM, error: Invalid configuration for device "0"
or
The clone operation fails at 99%

This issue occurs if the hosts used in the clone process are set with UTC time and are not in sync.
To workaround this issue, adjust the time settings on the hosts.
  1. Connect to vCenter Server via the vSphere Client.
  2. Select a host and click the Configuration tab.
  3. Click Time Configuration under Software.
  4. Click Properties
  5. Manually adjust the time so that it is correct and is in sync with the other hosts in the environment.
  6. Repeat Steps 2 to 5 on all hosts involved in the cloning process.


Additional Information