Snapshot Deletion Fails Due to Error "vim.fault.GenericVmConfigFault. The virtual machine is a template"
book
Article ID: 368221
calendar_today
Updated On:
Products
VMware vSphere ESXi
Issue/Introduction
A VM's snapshots are unable to be deleted or consolidated.
Note: While this issue is typically observed from the vSphere web GUI, the error thrown when consolidating or deleting snapshots is rather generic. To confirm this particular issue effects a VM, verify by tracing Steps 1-5 of Method 1 and Method 2 in the Resolution section below. If the templateVM parameter is set to FALSE, then this issue is not the cause of the snapshot deletion and consolidation failures.
Symptoms:
From the vSphere GUI a Delete All Snapshots job for a VM throws the error "A general system error occurred: Fauled cause: vim.fault.GenericVmConfigFault."
From the ESXi Host GUI a Delete All Snapshots job for a VM throws the error "Failed to delete all snapshots from virtual machine: 'VM_NAME'"
The following ESXi Host/Virtual Machine Log entries are observed:
From /var/log/hostd.log:
2024-08-19T21:08:52.856Z verbose hostd[2100208] [Originator@6876 sub=Vigor.Vmsvc.vm:/vmfs/volumes/<Datastore>/<VM_Directory>/<VM_Name.vmx> opID=1930505e-02-9c-7adf] Delete snapshot 1 and its children message: An error occurred while deleting a snapshot: The virtual machine is a template.
From /vmfs/volumes/<vm_directory>/vmware.log:
2024-08-19T21:08:52.856Z In(05) vmx 47839-118772-auto-2jn9-h5:70024065-9-ed-e857 SNAPSHOT: Snapshot_Delete failed: The virtual machine is a template (19)
Note: Timestamps and opID numbers in the log entries above are strictly shown for example. File paths have also been altered with placeholder values.
Environment
vCenter Server 7.0.x
vCenter Server 8.0.x
vSphere ESXi 7.0.x
vSphere ESXi 8.0.x
Cause
This can occur if a VM was deployed using a public OVF template downloaded from a third party vendor that specified the value templateVM = "True" in the VM's .vmx file. While the VM may appear and behave as a normal VM in the GUI, this value will prevent snapshot deletion/consolidation.
Resolution
Note: Brief downtime will be required to resolve this issue as the VM will need to be powered off.
Method 1 - vSphere GUI:
Navigate and log into the vSphere web GUI
Navigate to the VM
Power off the VM: Click Actions > Power > Shut Down Guest OS
Enter the Edit Settings page for the VM: Click Actions > Edit Settings > AdvancedParameters tab
Filter the Attribute column for "templateVM". The Value column will be listed as TRUE
Click on the TRUE value and replace it with the value FALSE. Once entered, click the check box and then OK to save the changes. Once saved, go back and verify that the setting now shows a value of FALSE instead of TRUE
Delete/Consolidate the VM's snapshots.
Power on the VM
Method 2 - ESXi Host GUI:
Navigate and log into the ESXi Host web GUI of the host the VM is registered to
Power off the VM: Click Actions > Guest OS > Shut Down
Navigate to the VM's Edit Settings page: Click Actions > Edit Settings
Navigate to the VM's Advanced Configuration Parameters page: Click VM Options tab > Expand Advanced > Click Edit Configuration
Using the Search bar on the top right, filter for templateVM
Click on the Value that is set as TRUE and change it to FALSE. Click OK to save changes. Once saved, go back and verify the Value is now set to FALSE
Delete/Consolidate the VM's snapshots
Power on the VM
Method 3 - CLI:
Power off the VM
SSH or Console into the host the VM is registered to
Use the VI Editor to enter into the VM's .vmx file using the following command:
vi /vmfs/volumes/VM_Datastore/VM_Directory/VM_Name.vmx
Press the Insert key to enter Edit Mode
Using the arrow keys, navigate down to the line templateVM = "TRUE"
Using the arrow and backspace keys, remove TRUEand replace the value with FALSE
Use the ESC key to exit Edit Mode
Type :wq!and press Enter to save changes. Verify the changes saved by using the same command from Step 3, or the following command:
less /vmfs/volumes/VM_Datastore/VM_Directory/VM_Name.vmx