VMware Cloud Community
EdOfTheMountai2
Contributor
Contributor
Jump to solution

Edited vmx file without removing from inventory first - How can I fix?

When I  Datastore Browser to the vmx, it does not recognize the vmx file as a VM and does not give option to Add?

How I Got Into This Situation:

  1. Shut-down VM and ssh to ESXi
  2. Used vi to edit vmx file
  3. vi could not save, so I put ESXi host in maintenance mode figuring that was the problem
  4. vi could still not save vmx, so I chmod +w the vmx file
  5. Tried to restart, vSphere tells me cannot find vmx file
  6. I thought maybe remove from inventory and re-add, so I removed from inventory
  7. When I use Datastore Browser to the vmx, it does not recognize the vmx file as a VM and does not give option to Add

The changes I made to vmx were to delete these:

ethernetN.generatedAddress

ethernetN.addressType

ethernetN.generatedAddressOffset

and add these:

ethernet0.addressType = "static" 

ethernet0.address = 00:0c:29:1f:4c:31

Can anyone offer any tips on how to get a manually edited VM back into inventory?

Thanks in advance,

-Ed

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
rcporto
Leadership
Leadership
Jump to solution

The double quote for the ethernet0.checkMACAddress are in different format from the other values, see:

ethernet0.pciSlotNumber = "160"

ethernet0.checkMACAddress = “false”

ethernet0.addressType = "static"   

ethernet0.address = "00:0C:29:2F:4C:31"

---

Richardson Porto
Senior Infrastructure Specialist
LinkedIn: http://linkedin.com/in/richardsonporto

View solution in original post

0 Kudos
10 Replies
rcporto
Leadership
Leadership
Jump to solution

You may try rebuild the .vmx file from the vmware.log, see: VMware KB: Rebuilding the virtual machine's .vmx file from vmware.log

---

Richardson Porto
Senior Infrastructure Specialist
LinkedIn: http://linkedin.com/in/richardsonporto
a_p_
Leadership
Leadership
Jump to solution

What I'm not sure about is why you were not able to save the file!?

Anyway, there might be a syntax error in the file (e.g. missing quotes). Either double-check the modified entries for errors, or attach the .vmx file to a reply post.

Btw. which ESXi version/build do you use?


André

0 Kudos
EdOfTheMountai2
Contributor
Contributor
Jump to solution

I attached vmx file.

[root@localhost:~] vmware -vl

VMware ESXi 6.0.0 build-3029758

VMware ESXi 6.0.0 Update 1

I think the vmx file is fine.  Could it be some kind of security issue?

Did ESXi make a checksum or hash of the vmx, and now that I manually edited the vmx, ESXi refuses to recognize it?

I added these three lines:

        ethernet0.checkMACAddress = “false”

ethernet0.addressType = "static"      

ethernet0.address = "00:0C:29:2F:4C:31"


I wrapped the MAC address in quotes after seeing one KB article with quotes and another without.  I also changed all hex chars to uppercase.  The Datastore Browser does still not recognize as a vmx or present option to add back into inventory?



0 Kudos
EdOfTheMountai2
Contributor
Contributor
Jump to solution

ESXi 6

[root@localhost:~] vmware -vl

VMware ESXi 6.0.0 build-3029758

VMware ESXi 6.0.0 Update 1

0 Kudos
rcporto
Leadership
Leadership
Jump to solution

The double quote for the ethernet0.checkMACAddress are in different format from the other values, see:

ethernet0.pciSlotNumber = "160"

ethernet0.checkMACAddress = “false”

ethernet0.addressType = "static"   

ethernet0.address = "00:0C:29:2F:4C:31"

---

Richardson Porto
Senior Infrastructure Specialist
LinkedIn: http://linkedin.com/in/richardsonporto
0 Kudos
EdOfTheMountai2
Contributor
Contributor
Jump to solution

Your are right. I had added that line in desperation. I fixed it - same problem.

I just deleted - same problem.

Do I need to reboot or anything when editing vmx files so that ESXi sees the change?

The Datastore Browser still recognizes it as a normal file, NOT a vmx file.

0 Kudos
EdOfTheMountai2
Contributor
Contributor
Jump to solution

You were right it was a VMX file problem.  Not sure what though.  Maybe some hidden characters when I cut and pasted from a KB article into VI editor.

I deleted the other 2 changes and now Datastore Browser recognizes it as Vmx file again.

0 Kudos
rcporto
Leadership
Leadership
Jump to solution

You're welcome and don't forget mark answers as helpful or correct.

---

Richardson Porto
Senior Infrastructure Specialist
LinkedIn: http://linkedin.com/in/richardsonporto
0 Kudos
EdOfTheMountai2
Contributor
Contributor
Jump to solution

Thank you both.

While a related but different issue, I still cannot add it to inventory.

Register VM

A VM or template having same name is already registered.

Save error: Specified key, name or identifier '21' already exists.

This may be a result of trying to command line register the vmx file thinking it might fix the problem.

The inverse command of this:

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


Solved the final problem and VM is running again:

vim-cmd vmsvc/unregister vmid

Thanks again,

-Ed

0 Kudos
rcporto
Leadership
Leadership
Jump to solution

Check if helps: VMware KB: Determining a virtual machine's associated vmx/.vmtx file

---

Richardson Porto
Senior Infrastructure Specialist
LinkedIn: http://linkedin.com/in/richardsonporto
0 Kudos