Oops - my VM is stuck!

One of the drawbacks of a virtual machine is... that it does not have a power plug! So you can't, after all else failed, pull the plug to get it to turn off.

So what do you do if you "Reset" a virtual machine in VMWare ESXi and it gets stuck at 95% of doing so? Wait - right? But what if it's still sitting there being stuck a few hours later? Then you begin to panic. Especially if said VM is the one running your vCenter...

The easy anwer to the problem is that probably all you need to do is to restart the VMWAre host's management agents. In order yo do so, you'lle need console access to your ESX host - so pray that you have ILO, DRAC - or a good old fashioned monitor and keyboard handy. If that's possible , then you need to log in with your root account - once again I hope you got that handy (I didn't and had to go hunting for half an hour). Then you need to go to the troubleshooting options and select "restart management agents". Piece of cake - right?

Just a few caveats though:

  • Be sure there aren't any machines set to auto-start which are currently turned off. If they DO exist they will begin to boot right after you start your management agent. It might be a wise idea to prevent that, depending on what they are or do...
  • When you want to start your "offending" VM it might not be there. In my case it showed up as "corrupted" (there went my adrenaline again). I removed the VM from Inventory and re-added it - which did made it appear nicely again.

After re-adding it wouldn't boot, though. Closer inspection revealed that its swap file was still locked. Luckily the VMWare KB has a great article here (which I'm NOT going to type here!) - and that did the trick. Phew!