During a maintenance on of the hosts I manage, I discovered that the host was unable to go into maintenance mode because of an mounted VMtools ISO. I was unable to easily unmount the VMtools ISO from the virtual machine.
In this article, I will show you how to troubleshoot and eventually how to fix this issue.
Note: Eventhough the article mentioned explicitly “Unable to eject/cancel VMtools ISO in vCloud Director 9.7“, you can also use this article to cancel a VMtools installation task on a platform without a vCloud Director instance.
Table of Contents
Troubleshooting on the vCloud layer
Because of the vCloud instance that is running inside this platform, I need to start the investigation first on the vCloud layer. We already know which virtual machine is blocking the host to go into maintenance mode. With the virtual machine name already in place, we will now navigate through the vCloud Director GUI to the correct OrgvDC that contains the virtual machine.
The next step is to disconnect the ISO from the virtual machine with the option called Eject Media. To do so, click on the three dots next to the virtual machine and select Eject Media.
The error messages that was described in the task details window are: “The operation could not be performed because the object is in an invalid state.” and “The operation is not allowed in the current state of the host.”.
Troubleshooting on the vCenter layer
We are now trying to perform the same steps to disconnect the VMtools ISO but this time from the vCenter GUI. To do so, select the virtual machine, click on actions and select Unmount VMtools installer.
The error message that I got when I tried to unmount the VMtools installer was: “The operation is not allowed in the current state of the host”.
We are getting exactly the same error message as the one that was shown in the vCloud Director GUI.
Troubleshooting on the ESXI layer
In the previous troubleshooting steps, I was unable to eject or to unmount the VMtools ISO from the vCloud or vCenter GUI. We will now try to eject/unmount the VMtools ISO but this time on the ESXI layer.
First of all, we need to find the VMid from the virtual machine that is blocking the host to go into maintenance mode. To do so, login with SSH into the host (the host that runs that specific virtual machine) and use the following command to output all the virtual machines on that host with their VMid.
With the VMid in place, we can now execute the following command on the host that runs the virtual machine. Replace the VMid with the id of the virtual machine that has the ISO mounted.
vim-cmd vmsvc/tools.cancelinstall VMid
The VMtools ISO has been successfully unmounted from the virtual machine. The host could finally been placed in maintenance mode without any issues.
You are probably wondering: what could possibly cause this issue? Well, I cannot tell you exactly what is causing this issue but I have some ideas. I tried to reproduce the issue. Unfortunately, I couldn’t reproduce the issue with another virtual machine. I also checked when the install VMtools task was given and that was not recent. So I guess that leaving the VMtools ISO mounted for a longer period of time might be the cause of the invalid state error message.
If you have questions about this article, please do not hesitate to contact me via the contact form.