Saturday, April 16, 2011

VirtualBox: Could not find an open hard disk with UUID

My VirtualBox sometimes shows a dialog box that says:

"One or more virtual hard disks, CD/DVD or floppy media are not currently accessible."

My virtual machine becomes inaccessible. Details show this error:

Could not find an open hard disk with UUID {5bad2863-64d0-40a2-a394-7442e3a6adc7}.
Result Code: VBOX_E_OBJECT_NOT_FOUND (0x80BB0001)

This happens when a snapshot is removed, then another snapshot is made and the host computer crashes (e.g. freezes during hibernation). After this, there is a reference to a non-existing HardDisk in the configuration file "~/.VirtualBox/VirtualBox.xml". This needs to be updated with the real value. The last working situation can be found in the log file (e.g. "~/.VirtualBox/Machines/<...>/Logs/VBox.log")

00:00:01.330 [/Devices/piix3ide/0/LUN#0/AttachedDriver/Config/] (level 6)
00:00:01.330   Format   = "VDI" (cb=4)
00:00:01.330   Path     = "/data/vmware/winvm/{5bad2863-64d0-40a2-a394-7442e3a6adc7}.vdi" (cb=62)
00:00:01.330   Type     = "HardDisk" (cb=9)
00:00:01.330 [/Devices/piix3ide/0/LUN#0/AttachedDriver/Config/Parent/] (level 7)
00:00:01.330   Format   = "VDI" (cb=4)
00:00:01.330   Path     = "/data/vmware/winvm/{cd71486f-ab71-4b03-9e2e-690d7ef76b9d}.vdi" (cb=62)
00:00:01.330 [/Devices/piix3ide/0/LUN#0/AttachedDriver/Config/Parent/Parent/] (level 8)
00:00:01.330   Format   = "VDI" (cb=4)
00:00:01.330   Path     = "/data/vmware/winvm/Windows XP flexible disk.vdi" (cb=48)

This shows reliably the structure (the snapshot and its parents are listed), so it can be reconstructed by editing the XML file accordingly.