Deleting inaccessible VMs from the VirtualBox GUI via the command line

I recently had a big clear out of my Virtual Machines directory and deleted quite a few VMs that I wasn’t using anymore. Perhaps I should have done this via VirtualBox itself, as when I next opened up VirtualBox the application’s user interface seemed frozen or locked, and all I could see was an error message about my inaccessible VMs (the ones I had deleted outside of VirtualBox).

To get VirtualBox’s UI working again, I needed to get rid of these inaccessible machines, but I couldn’t remove anything via the unresponsive user interface.

I ended up unregistering the inaccessible VMs by using the VirtualBox command line interface, in particular the commands

VBoxManage list vms

and

VBoxManage unregistervm

These give a list of the VMs managed by VirtualBox, and then make it easy to unregister/remove the inaccessible ones.

To get started, close the VirtualBox GUI and run the commands below. This will help you identify all the inaccessible VMs and then allow you to unregister them by refering to a particular VM’s UUID (the long identifier wrapped up in the curly brackets).

➜ VBoxManage list vms
"<inaccessible>" {c9d3f17a-8f97-11e6-ae22-56b6b6499611}
"<inaccessible>" {93e61830-8f98-11e6-bdf4-0800200c9a66}
"IE8 - Win7" {db83c590-07a6-4101-8519-22eef9ea26b5}
➜ VBoxManage unregistervm c9d3f17a-8f97-11e6-ae22-56b6b6499611
➜ VBoxManage unregistervm 93e61830-8f98-11e6-bdf4-0800200c9a66

After doing this, you can reopen the VirtualBox GUI and it should be operational again.