35

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.)

9 Answers 9

55

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)
  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

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

5
  • 2
    This worked for me, but I also had a DVD "inserted" in the VM that I was manually copying. When I edited my .vbox file, I had to change <DVDImages>...</DVDImages> to just <DVDImages /> to "eject" the DVD with the duplicate UUID.
    – JPhi1618
    Dec 1, 2014 at 20:31
  • 1
    Note that if the VM has snapshots you'll also have to do the same steps on the vdi files in the "Snapshots" folder.
    – laurent
    Jun 30, 2015 at 8:05
  • Very helpful. Especially important here is that the UUID's are just string values, you can get them through any methods you choose. Key thing is that they are unique as pasted into the VBox file. Whew.
    – pauljohn32
    May 17, 2020 at 3:13
  • Works like a chamr. Quick and easy solution, thanks! Dec 5, 2020 at 16:31
  • 1
    This gets very messy if you have multiple snapshots and hard disks.
    – Marcin
    Jul 15, 2021 at 0:52
8

I've found a simpler way to do it.

Clone the existing virtual machine. This creates a new version with presumably a new uuid, but in all other respects it is the same machine.

Then copy the one you want to add, to your \user(your name)\Virtual Box VMs\ (or wherever the location is for your virtual machines) and overwrite all the existing files there, to replace the existing machine.

I would back up the existing machine first just in case, before doing that, but it worked just fine here. Used it to go back to an earlier backup of a VM while keeping the existing version as a clone.

3
  • 1
    if you have enough disk space, this is the easiest way, thanks Robert.
    – sddk
    Sep 7, 2016 at 14:05
  • If any one does this - they should make sure the vbox file has a hardware uuid tag that matches the machine uuid :: <hardware uuid="{...}" >, then they can change hard disk uuid and machine uuid with out any issues. <hardware uuid="{...}" >
    – StixO
    Jan 1, 2019 at 17:56
  • This is the easiest way if you have multiple harddrives and snapshots.
    – Marcin
    Jul 15, 2021 at 1:07
5

If you are unable to launch due to this error, simply 'Remove...' the entry from the 'Oracle VM VirtualBox Manager'. This will clear the conflict and you will then be able to open the VM from its new location.

...At that point you can perform a clone if that is what you intend. In my case, no additional effort was required since I no had no further need for the original location of the VM.

1
  • This is by far the simplest solution, and not only that, it works.
    – shmu
    Jul 8, 2019 at 6:45
2

I realize this is an old post but I ran upon this error. I resolved it by:

  1. Open Virtual Box Manager
  2. Right click on the virtual machine in the Virtual Box Manager
  3. Click "Remove"
  4. A pop-up will appear. Choose "Remove only" which will simply remove all traces of the virtual box from the Virtual Box Manager
  5. Close the Virtual Box Manager
  6. Using the Linux file manager, browse to the folder containing the virtual machine
  7. Delete (or move) everything EXCEPT the .vmdk virtual hard disk file
  8. Open Virtual Box Manager
  9. Click "Machine"
  10. Click "New"
  11. Name the new machine (I used the same name as I originally used)

    NOTE: The name of the machine is will become the name of the directory that will contain the virtual machine so choose wisely and also note that if you want the .vmdk file to reside in the new directory that it will take additional steps in Virtual Box Manager

  12. Select the proper Type and Version for the virtual machine that was having the issue and click "Next"
  13. Select the memory size you want the virtual machine to have allocated and click "Next"
  14. Select "Use and existing virtual hard disk file" and select it by browsing to it's location
  15. Select "Create"

Simply follow the prompts from there and then start the virtual machine.

Everything runs fine, no re-activation of windows or etc. required.

1

You can also clone the existing machine then go into settings and change the storage to use the .vmdk that you had copied earlier.

1

Linux Only:

  1. Generate a new VM UUID:

head /dev/urandom | tr -dc A-Fa-f0-9 | head -c 32 | tr '[:upper:]' '[:lower:]' | sed -r 's@^([0-9a-f]{8,8})([0-9a-f]{4,4})([0-9a-f]{4,4})([0-9a-f]{4,4})([0-9a-f]{12,12})$@\1-\2-\3-\4-\5@'

  1. Open the VM's "<VM's Name>.vbox" configuration file and replace the Machine uuid with your new uuid. <Machine uuid="{a6f16f74-a0a8-dba3-c24a-198cf1bfdb94}"

  2. Add the VM to VirtualBox

0

I was successfully doing it by just change machine UUID and Harddisk UUID. I don't need to change image uuid to done it

-1

User TGR got it right, but I had to make one additional change: In the vbox XML I needed to change the Image uuid to match the HardDisk uuid (the second UUID generated on the command line)

<StorageControllers>
   <StorageController ...>
     <AttachedDevice ...>
       <Image uuid="{ [second UUID] }"/>
-1

I've found another way simpler than any other. You only have o delete the virtual machine from Virtual Box interface (if it asks you if you want to delete the files of the VM, respond NOT!, or you'll lose the VM). And then go to the .vbox file and open it (with Virtual Box). It should work because you have deleted the UUID (while deleted the VM). At least it worked for me...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .