# Trying to open a VM config which has the same UUID as an existing virtual machine

virtualbox

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 I get the message

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


(Yes, the machines should have been cloned instead of simple file copy, but it is too late at this point.)

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.
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)
2. open the .vbox file in a text editor
3. replace the UUID found in <Machine uuid="{...}" with the UUID you got when you ran sethduuid the first time
4. 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