You are on page 1of 4

RESETTING UUID’S ON A VIRTUAL-BOX VM

by Paul Cannon on 15th August 2016 No comments


I use Oracle’s Virtual Box for maintaining a fleet of VM’s which I use for customer work
and for playing with new versions of BI software from Oracle. With back-up copies and
duplicates whilst trying different things, I often cheat and simply copy the VM files rather
than properly cloning them, so I regularly come across the problem of not being able to
load a virtual machine because another virtual machine has the same UUID:

“Trying to open a VM Config …… which has the same UUID as an existing virtual
machine.”

In this screen shot the ‘Inaccessible’ vm is on an external disk I’ve unplugged and I want
to open a duplicate old copy that’s on a different external disk.

The quick workaround is to just remove the existing virtual machine, but that then
requires it to be re-added later on. A better solution if both VM’s are to be kept for a
period of time is to change the UUID on one of them.

Unfortunately, there isn’t a menu option to do this (that would just be too easy…)
Instead you need to use a command level tool called VBoxManage.exe
This can be found in the installation directory of Virtual Box, in my case C:\Program
Files\Oracle\VirtualBox\

You need to run this command in a command window with three parameters:

 internalcommands
 sethduuid
 the path of the .vmdk virtual box image file, in my case C:\Users\paulc\VirtualBox
VMs\LinuxVM – OBIEE12c\LinuxVM.vmdk

for example:

"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" internalcommands sethduuid


"C:\Users\paulc\VirtualBox VMs\LinuxVM - OBIEE12c\LinuxVM.vmdk"

Note: I’ve put the paths to the VboxManage.exe and my .vmdk file inside quotes as they
both contain spaces, which the command window doesn’t like.

Whilst this command changes the UUID of the .vmdk hard disk file it doesn’t actually
change the UUID of the machine. However you still need a new UUID for the machine.
The way to do this is to run the VBoxManage command twice. The UUID from the
second run will be used by the hard disk leaving the first available for the machine!

So run this command twice:

Having got two new UUIDs you now need to edit the .vbox file for the virtual machine
(usually located in the same directory as the .vmdk file) using a text editor to inform the
virtual machine of the new settings.

Near the top of the file locate the <Machine uuid tag and replace the uuid between the
curly brackets with the first new uuid from above. Then a little further down locate the
<HardDisk uuid tag and replace the uuid with the second new uuid from above:
Then towards the end of the file locate the <Image uuid tag within the <AttachedDevice
tag. This is the same uuid as the hard disk, so again replace this with the second uuid
from above:

That’s it! Save the file and add the machine into Virtual Box

So my old duplicate VM can now be started, but the Inaccessible VM is still loaded and
will work fine next time I plug its external disk in.

Enjoy!
For two attached disks, one a .vmdk and the second a .vdi

You might also like