Powering off the virtual machine
- Connect VMware Infrastructure/vSphere Client to the vCenter Server. Right-click the virtual machine and click Power off.
- Connect vSphere Client directly to the ESX host. Right-click the virtual machine and click Power off.
If this does not work, you must use the command line method.
- Determine the host on which the virtual machine is running. This information is available in the virtual machine’s Summary tab when viewed in the vSphere Client page.
- Log in as root to the ESX host using an SSH client.
- Run this command to verify that the virtual machine is running on this host:# vmware-cmd -l
The output of this command returns the full path to each virtual machine running on the ESX host. Verify that the virtual machine is listed, and record the full path for use in this process. For example:# /vmfs/volumes/<UUID>/<VMDIR>/<VMNAME>.vmx
- Run this command to determine the state in which the ESX host believes the virtual machine to be operating:
# vmware-cmd <path.vmx> getstateIf the output from this commandisgetstate() = on, the vCenter Server may not be communicating with the host properly. This issue must be addressed in order to complete the shutdown process.
If the output from this command is getstate() = off, the ESX host may be unaware it is still running the virtual machine. This article provides additional assistance in addressing this issue.
- From the Service Console of the ESX host, run the command:
vmware-cmd <path.vmx> stop
Note: <path.vmx>is the complete path to the configuration file, as determined in the previous section. To verify that it is stopped, run the command:
# vmware-cmd <path.vmx> getstate
- From the Service Console of the ESX host, run the command:
# vmware-cmd <path.vmx> stop hard
Note:<path.vmx>is the complete path to the configuration file, as determined in the previous section. To verify that it is stopped, run the command:
# vmware-cmd <path.vmx> getstate
- If the virtual machine is still inaccessible, proceed to the next section.
-
Determine the WorldID of the virtual machine with the command:
# vm-support -x
-
- Kill the World_ID of the virtual machine by using this command in the root directory of the host:
# vm-support -X <world_ID>
- Kill the World_ID of the virtual machine by using this command in the root directory of the host:
It can take upwards of 30 minutes to terminate the virtual machine. Exercise patience to avoid corruption.
Note: This command uses several different methods to stop the virtual machine. When attempting each method, the command waits for a predetermined amount of time. The timeout value can be configured to be 0 by adding the -d0 switch to the vm-support command.
- List all running virtual machines to find the VMID of the affected virtual machine with the command:
# cat /proc/vmware/vm/*/names
-
Determine the master world ID with the command:
# cat /proc/vmware/vm/####/cpu/status | less
-
Scroll to the right with the arrow keys until you see the group field. It appears similar to:
Group
vm.####
-
Run this command to shut the virtual machine down with the group ID:
# /usr/lib/vmware/bin/vmkload_app -k 9 ####
- List all running virtual machines to find the vmxCartelID of the affected virtual machine with the command:
# /usr/lib/vmware/bin/vmdumper -l
-
Scroll through the list until you see your virtual machine’s name. The output appears similar to:
vmid=5151 pid=-1 cfgFile=”/vmfs/volumes/4a16a48a-d807aa7e-e674-001e4ffc52e9/mdineeen_test/vm_test.vmx” uuid=”56 4d a6 db 0a e2 e5 3e-a9 2b 31 4b 69 29 15 19″ displayName=”vm_test” vmxCartelID=####
-
Run this command to shut the virtual machine down with the vmxCartelID:# /usr/lib/vmware/bin/vmkload_app -k 9 ####
- To determine if the virtual machine process is running on the ESX host, run the command:
# ps auxwww | grep -i <VMNAME>.vmxThe output of this command appears similar to this if the .vmx process is running:
root 3093 0.0 0.3 2016 860 ? S< Jul30 0:17 /usr/lib/vmware/bin/vmkload_app /usr/lib/vmware/bin/vmware-vmx -ssched.group=host/user -# name=VMware ESX Server;version=3.5.0;licensename=VMware ESX Server;licenseversion=2.0 build-158874; -@ pipe=/tmp/vmhsdaemon-0/vmx569228e44baf49d1; /vmfs/volumes/49392e30-162037d0-17c6-001f29e9abec/<VMDIR>/<VMNAME>.vmx
The process ID (PID) for this process is in bold. In this example, the PID is 3093. Take note of this number for use in these steps.Caution: Ensure that you identify the line specific only to the virtual machine you are attempting to repair. If you continue this process for a virtual machine other than the one in question, you can cause downtime for the other virtual machine.
If the .vmx process is listed, it is possible that the virtual machine has lost control of the process and that it must be stopped manually.
- To end the process, run the command:# kill <PID>
- Wait 30 seconds and check for the process again.
- If it is not terminated, run the command:# kill -9 <PID>
- Wait 30 seconds and check for the process again.
- Where possible, it may be necessary to migrate the virtual machine to another host and attempt the kill instruction from that host.
- If it is not terminated, the ESX host may need to be rebooted to clear the process. This is a last resort option, and should only be attempted if the preceding steps in this article are unsuccessful.
Categorised as: Linux/OSX, Networking, Virtual Infrastructure, VMWare/ESX
Leave a Reply
You must be logged in to post a comment.