Oracle VM Virtual Box: Virual Machine Copying UUID Error

Learn | Teach Open Source Technologies

Oracle VM Virtual Box: Virual Machine Copying UUID Error

Problem:

When trying to add two VirtualBox virtual machines which have been originally copied (via simple file copy) from the same source, on adding the second one get the message:

Failed to open virtual machine […]
Trying to open a VM config […] which has the same UUID as an existing virtual machine.

Solution:

You can use VBoxManage internalcommands sethduuid <VDI/VMDK file> (Run from the VBox install directory) to change the HD UUID, but this has two shortcomings: it does not update the .vbox file, and it does not change the machine UUID (I did not find any way to do this with VBoxManage), just the HD UUID.

The following worked for me (Win 7, most recent VirtualBox version):

1. run VBoxManage internalcommands sethduuid <VDI/VMDK file> twice (the first time is just to conveniently generate an UUID, you could use any other UUID generation method instead)

First time:
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands sethduuid “D:\VirtualBox VMs\cos-minimal\cos-5.vdi”

UUID changed to: 95d78fc9-0e15-465c-b496-14c269aa1e07

Second time:
C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands sethduuid “D:\VirtualBox VMs\cos-minimal\cos-5.vdi”

UUID changed to: c8195b11-ec17-450a-9a00-12e45e5404d5

2.    open the .vbox file in a text editor
replace the UUID found in <Machine uuid=”{…}” with the UUID you got when you ran sethduuid the First time.

3.    replace the UUID found in <HardDisk uuid=”{…}” and in <Image uuid=”{}” (towards the end) with the UUID you got when you ran sethduuid the second time

You can add the virtual machine after that. Not a very clean solution, but does not seem to cause any problem.

=====================================================

Conclusion: Always use Clone option to create another instance of Virtual Machine with same configuration.