[SOLVED] Duplicate UUID issue with vhd images

Discussions related to using VirtualBox on Linux hosts.
Locked
shapeshed
Posts: 6
Joined: 2. Mar 2009, 16:06
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: XP, Vista, Windows 7, Ubuntu 9.04
Location: London
Contact:

[SOLVED] Duplicate UUID issue with vhd images

Post by shapeshed »

Firstly VirtualBox is simply fantastic. I've been using Parallels on OSX and it beats it hands down, even with less RAM.

I have a small issue. I'm using VirtualBox on Ubuntu and virtualising the VPC images made available by Microsoft here for browser testing purposes. http://www.microsoft.com/Downloads/deta ... laylang=en

Everything works really well but if I try to add more than one of the XP images to the virtual media manager I get the following error.
Cannot register the hard disk '/home/george/.VirtualBox/HardDisks/XP SP3 with IE6 2008-Dec.vhd' with UUID {b6202eec-1791-b921-4c0c-4306e34cc487} because a hard disk '/home/george/.VirtualBox/HardDisks/XP SP3 with IE6 2008-Dec.vhd' with UUID {b6202eec-1791-b921-4c0c-4306e34cc487} already exists in the media registry ('/home/george/.VirtualBox/VirtualBox.xml').
I have attempted to change the UUID using the command line

Code: Select all

george@george-ubuntu:~/.VirtualBox/HardDisks$ VBoxManage internalcommands sethduuid XP\ SP3\ with\ IE6\ 2008-Dec.vhd 
VirtualBox Command Line Management Interface Version 2.1.4
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

UUID changed to: 46a453bd-4d03-4988-a066-6ecfc6ced308
But the same error persists when trying to add the hard drive.

Here's the auto-generated config

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!-- Sun xVM VirtualBox Global Configuration -->
<VirtualBox xmlns="http://www.innotek.de/VirtualBox-settings" version="1.6-linux">
  <Global>
    <ExtraData>
      <ExtraDataItem name="GUI/LicenseAgreed" value="7"/>
      <ExtraDataItem name="GUI/UpdateCheckCount" value="2"/>
      <ExtraDataItem name="GUI/UpdateDate" value="1 d, 2009-03-03"/>
      <ExtraDataItem name="GUI/RegistrationData" value="triesLeft=0"/>
      <ExtraDataItem name="GUI/SuppressMessages" value=",confirmInputCapture"/>
      <ExtraDataItem name="GUI/LastWindowPostion" value="614,190,755,506"/>
      <ExtraDataItem name="GUI/LastVMSelected" value="{dff39fc8-84b9-45f9-908c-825e82950955}"/>
    </ExtraData>
    <MachineRegistry>
      <MachineEntry uuid="{612fe944-278c-4018-8785-bf2424e3b0e9}" src="Machines/XP SP3 IE6/XP SP3 IE6.xml"/>
      <MachineEntry uuid="{cc87b70c-537d-4fa3-a78c-d435d005887b}" src="Machines/XP SP3 IE7/XP SP3 IE7.xml"/>
      <MachineEntry uuid="{608e3882-5b2a-4c4b-aafd-591319d78dbe}" src="Machines/XP SP3 IE8/XP SP3 IE8.xml"/>
      <MachineEntry uuid="{dff39fc8-84b9-45f9-908c-825e82950955}" src="Machines/Vista Business IE7/Vista Business IE7.xml"/>
    </MachineRegistry>
    <MediaRegistry>
      <HardDisks>
        <HardDisk uuid="{9102a1bc-a0e0-dc11-827f-9ab851f2bb30}" location="/home/george/.VirtualBox/HardDisks/Vista Business with IE7.vhd" format="VHD" type="Normal"/>
        <HardDisk uuid="{b6202eec-1791-b921-4c0c-4306e34cc487}" location="/home/george/.VirtualBox/HardDisks/XP SP3 with IE6 2008-Dec.vhd" format="VHD" type="Normal"/>
      </HardDisks>
      <DVDImages>
        <Image uuid="{0b1f4b5b-25f8-4e95-9aa6-2c9714f964b8}" location="/usr/share/virtualbox/VBoxGuestAdditions.iso"/>
      </DVDImages>
      <FloppyImages/>
    </MediaRegistry>
    <USBDeviceFilters/>
    <SystemProperties defaultMachineFolder="Machines" defaultHardDiskFolder="HardDisks" defaultHardDiskFormat="VDI" remoteDisplayAuthLibrary="VRDPAuth" webServiceAuthLibrary="VRDPAuth" HWVirtExEnabled="false" LogHistoryCount="3"/>
  </Global>
</VirtualBox>

I have tried manually entering the newly generated UUID but it is seen but shown as not available

I suspect this is an issue with the vhds as this issue only occurs on the XP images and not the Vista image which has a different UUID. Any ideas greatly appreciated.
Last edited by shapeshed on 14. Apr 2009, 15:46, edited 1 time in total.
lodidadee
Posts: 6
Joined: 26. Feb 2009, 16:12

Re: Duplicate UUID issue with vhd images

Post by lodidadee »

I just did this yesterday but I used the VBoxManage tool..
http://78.46.147.154/viewtopic.php?p=9916
shapeshed
Posts: 6
Joined: 2. Mar 2009, 16:06
Primary OS: Mac OS X Leopard
VBox Version: OSE other
Guest OSses: XP, Vista, Windows 7, Ubuntu 9.04
Location: London
Contact:

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by shapeshed »

Thanks to Andrew Odri I have solved this. Microsoft's VHDs share the same hard disk identifier so you can use qemu to convert the image to a raw file and then VBoxManage to convert it to a .vdi.

Full write up for Ubuntu and Mac OSX can be found here or check out Andrew's post
MrKoen
Posts: 1
Joined: 2. Oct 2009, 11:33
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows XP, Windows 2003, Windows 2008
Location: The Netherlands
Contact:

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by MrKoen »

I encountered the same issue as described in this topic but was unable to resolve it using the steps outlined in previous posts. I did find another way to accomplish the same though. It's quite cumbersome and will take some time, but it works. Hopefully they will fix the change UUID command soon so this will become easier. The steps I took to allow a VHD copy to be used simultaneously under VirtualBox are:
  • 1. Use VirtualBox to create a new VDI disk. This may either be a dynamic disk or a fixed size disk
    2. Get your hands on a bootable iso image with a disk clone program like Norton Ghost or Hirens Boot CD. With some Googling you should be able to either find a direct download to one or find instructions how to make one yourself.
    3. Attach the new VDI from step 1 to the virtual machine with the disk you want to clone. Set the ISO from step 2 as the CD/DVD image to boot from.
    4. Run VirtualBox and press F12 so you can select the drive to boot from. Select the CD drive.
    5. Go through the clone process and clone the VHD to the VDI. In Norton Ghost use disk to disk copy for this. It may take a couple of hours to complete.
    6. After the cloning process has been completed, remove the VHD and the ISO boot cd from the virtualmachine and try to boot from the newly created VDI.
    7. This should work and allow you to still use the original VHD with its UUID in combination with another virtual machine.
Hope these steps are clear for the people needing it. If not, feel free to send me a PM.
Koen Zomers - Microsoft .NET Specialist - The Netherlands
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by Sasquatch »

On Linux, when you install Wine you can use the VDI tool from mpack to convert and clone the VHD to a VDI directly. See the sticky in this forum. If you happen to have a Windows machine nearby, I recommend you use that system instead of Wine, you never know if the file gets messed up (the original should stay uncorrupted).
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
adrian15
Posts: 1
Joined: 16. Feb 2010, 19:31
Primary OS: Debian Lenny
VBox Version: PUEL
Guest OSses: Debian Lenny

Easy workaround Duplicate UUID issue with vhd images

Post by adrian15 »

Here there is my easy workaround, just write the full path for each one of the files.

Code: Select all

VBoxManage clonevdi one.vdi two.vdi
should give an error.

Code: Select all

VBoxManage clonevdi /my/path/to/one.vdi /my/path/to/two.vdi
should work ok.

If both images are in the same folder where you are working you can do:

Code: Select all

VBoxManage clonevdi `pwd`/one.vdi `pwd`/two.vdi
Enjoy it!

adrian15
joseph@k2.com
Posts: 1
Joined: 13. Apr 2010, 20:24
Primary OS: Fedora other
VBox Version: OSE self-compiled
Guest OSses: win xp, 7, 2003, 2008

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by joseph@k2.com »

Thanks Adrian, that was nice and simple. However, in the 3.1.6 version I grabbed last week, the command-line seems to have changed just a little. This worked for me:

Code: Select all

VBoxManage clonehd `pwd`/one.vhd `pwd`/two.vhd
sajigeorge
Posts: 1
Joined: 15. May 2010, 21:53
Primary OS: MS Windows XP
VBox Version: PUEL
Guest OSses: Redhat 5

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by sajigeorge »

If still its not working in windows XP, try this

VBoxManage clonevdi UUID targetpath\tagetfile.vdi

Eg: VBoxManage clonevdi 46a453bd-4d03-4988-a066-6ecfc6ced308 "D:\vitualbox\clone.vdi"
whit
Posts: 27
Joined: 20. Mar 2010, 20:39
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 10.04

Re: Easy workaround Duplicate UUID issue with vhd images

Post by whit »

adrian15 wrote:

Code: Select all

VBoxManage clonevdi /my/path/to/one.vdi /my/path/to/two.vdi
should work ok.
See http://www.virtualbox.org/ticket/6367

If Oracle's not going to fix this so it works without specifying the full path, at least they might add this to the documentation of the function. That bug was filed for 3.0.12, and remains unfixed in 3.2.6.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by Perryg »

If you set the environmental variables in Windows you would not need to use the absolute path.
Just add the folder that has the VirtualBox main files to the path statement. If you use a different location for the VDI files you would need that in the statement as well. I see this as Windows not being able to find the location. It works for me.
whit
Posts: 27
Joined: 20. Mar 2010, 20:39
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 10.04

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by whit »

Perryg wrote:If you set the environmental variables in Windows you would not need to use the absolute path.
Just add the folder that has the VirtualBox main files to the path statement. If you use a different location for the VDI files you would need that in the statement as well. I see this as Windows not being able to find the location. It works for me.
Let me be clear. This is about running it in Linux, not Windows. There's no Windows involved in this report. That's why it's in the "VirtualBox on Linux Hosts" forum.

Getting off topic, but back to what we were properly discussing in the Windows host forum, Perry: Using the paths, I did clone the VM, and copy the clone back to the Windows 7 box that has been having trouble running it. Despite that it ran perfectly on a Linux host, including a dist-upgrade to the latest of the Ubuntu 10.04 components, the clone fails to start under Windows 7 just the same as before. And fails to start if I upgrade VB to 3.2.6 on Windows 7 - just in case it needs a matching version to the Linux host. I went through the entire process of setting up the clone as New in the Windows 7 host too. So it's not just some cruft that got in the XML file; it built itself a new one.

Back to topic here: There's plainly a lot of very broken stuff in VirtualBox. It's standard in *nix that if you're specifying a file that's in the directory, and to write to a file in that directory, and it's your present working directory, you don't need to specify the full path. This is Sun after all, they know *nix conventions. And VB's error isn't about not finding the file. It's about the file already being "registered" in the XML file, as if that should be a reason not to clone it. So there's an error even in what error message it gives!

The news here isn't that complex, ongoing software projects have bugs. The news is that Oracle has this out licensed for evaluation, and they're ignoring feedback from the evaluators. Not you, Perry. You're not Oracle, as you point out. But the bug report on this was filed 4 months ago. Fixing at least the documentation on this to get the workaround there would take someone all of 5 minutes to commit, for someone at Oracle. Cloning a VM is absolutely a central operation in a professional context - this isn't just something obscure broken nobody should much care about. Yet they leave it broken and undocumented so that people have to search out a workaround. Even your method of setting envars is a workaround.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by Perryg »

Code: Select all

perry@perry-u1004:~$ VBoxManage clonehd Xubuntu.vdi Xubuntu2.vdi
Oracle VM VirtualBox Command Line Management Interface Version 3.2.6
(C) 2005-2010 Oracle Corporation
All rights reserved.

0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone hard disk created in format 'VDI'. UUID: bcabb1a5-b8e4-410f-a4f9-9a5c130a6b54
perry@perry-u1004:~$ 
I don't have this problem either. I am sure that you and others do. There has to be a difference and when that is found then a solution would present itself.
Regarding the ticket in bugtracker. I do not see a guest log file listed in the ticket. The Devs are fairly strict about that.

Question: I see in the ticket that you run the VBoxManage command as root/SU. Were you logged in as root and do you always login as root?
Supposing that you did not install this as root but as su/sudo, try it as a normal user and see if the command can be run without the full path.
jago25_98
Posts: 4
Joined: 17. Aug 2011, 01:42
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: XP

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by jago25_98 »

On linux I had to do

vboxmanage clonevdi uid-without-brackets out.vdi
Om
Posts: 1
Joined: 21. Dec 2012, 21:57

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by Om »

Hi there,

I had the same UUID problem and a very easy fix worked for me. I went File>virtual media manager. I found the vdi file that was giving me issues. Selected it and removed (though it was showing up as inaccessible). Then started the VM again and selected the file from my local hard-disk. That was it!
Hope this works for you too. :)

Om
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [SOLVED] Duplicate UUID issue with vhd images

Post by mpack »

Most of the above is ancient history and/obsolete, e.g. VHD support was added a long time ago.

The way to avoid duplicate UUIDs in VHD/VDI/VMDK is to not use the host OS to copy the disk image file. Use a proper cloning tool instead, e.g. use "VBoxManage clonehd", or use the "Copy" feature of File|Virtual Media Manager.. You can also use CloneVDI (on Linux this this would require Wine).

Topic locked to prevent further discussion of obsolete issues.
Locked