Moving vbox + VM does not work: Duplicate UUID error?

Discussions related to using VirtualBox on Windows hosts.

Moving vbox + VM does not work: Duplicate UUID error?

Postby pstein » 14. Sep 2021, 22:30

Assume I installed a VisrtualBox VM in directory

D:\data\VBtest\

It contains a *.vdi and *vbox file

I can start it successfully.

After shutdown I moved the two files to another folder

D:\virtualbox\VM1\

After start (dobleclick *.vbox) I got an error popup:

Trying to open a VM config 'D:/virtualbox/VM1/LinuxMint/LinuxMint_20.1_VB_LinuxVMImages.COM/LinuxMint_20.1_VB_LinuxVMImages.COM.vbox' which has the same UUID as an existing virtual machine.

Hmm. VirtualBox seems to remember the UUID of the previous start from a different location.
How can I tell VirtualBox to ignore this duplication or automatically, silently update the UUID to the new folder?
pstein
 
Posts: 56
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby scottgus1 » 15. Sep 2021, 00:59

Virtualbox records the path to the .vbox file and the UUID of the VM. This error happens because double-clicking a .vbox file first attempts to register a VM if the path to the VM is new. Since this VM is already registered, it cannot register again.

To fix, move the VM files back where they were, so Virtualbox can run the VM normally. Then right-click the VM in the list and choose Move.
scottgus1
Site Moderator
 
Posts: 13236
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby Jetras » 15. Sep 2021, 02:43

If you ever need to change the UUID of a VM, use the following code:

Code: Select all   Expand viewCollapse view
VBoxManage internalcommands sethduuid filename.vdi


I keep a gold standard of VMs and have to move them around and duplicate them often, this command will assign a new UUID and avoid multiple issues.
Jetras
 
Posts: 17
Joined: 14. Sep 2021, 21:06
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows (2012 & 10), Linux (RHEL, Ubuntu, CentOS), FreeBSD (pfSense)

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby scottgus1 » 15. Sep 2021, 03:35

Thanks for the thought, Jetras! However,
Jetras wrote:change the UUID of a VM, use the following code:

VBoxManage internalcommands sethduuid filename.vdi


The .vdi is not the VM. Though changing drive file UUIDs can allow multiple copies of a drive file to be used (cloning the drive file also handles the UUID change during the copy) Pstein's problem centers around the .vbox file, which is the VM's 'motherboard', so to speak, and also has a UUID to be handled correctly. Moving a VM under 6.1 (maybe 6.0? can't remember) is easy using the Move command. Doing the move in the host OS's File Manager will cause the above error. (Full-cloning a VM will also make a copy with different UUID, so the copy and original can live on the same host.)
scottgus1
Site Moderator
 
Posts: 13236
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby pstein » 15. Sep 2021, 08:37

@scottgus1:

Thank you for your comments.

Does that mean that changing the UUID simply by the command provided by Jetras is not sufficient?

What if I cannot remember the exact original path?
Or cannot move it back to the original location (since it was on another computer not available any more).

Any chance to change/assign a new UUID to *.vdi AND *.vbox?

Are all the UUIDs stored in Windows Registry or in a (which ?) config file of a VirtualBox installation?
pstein
 
Posts: 56
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby BillG » 15. Sep 2021, 09:24

There seems to be a bit of confusion here. As I see it, there really is not any problem to solve, and there is no duplication of UUIDs.

Reading the original post again, what happened was that the OP tried to start the vm by a double click of the .vbox file. That will not start the vm but it will register the vm. The OP then tried to do the same thing again - double-click the .vbox file. This will try to register the same vm again, and of course it will fail with an error because that vm is already registered.

All the OP needs to do is to start the vm by clicking Start in VirtualBox Manager or start it from vboxmanage , not by double-clicking on the .vbox file.

There is no problem running two vms with the same UUID on two different hosts. You can even run two vms with the same UUID on the same host as long as you remember to remove one (ie deregister it) before you register the second copy. I know this works, because I did it recently. I upgraded a Windows 10 vm to Windows 11. I later restored the Window 10 vm from a backup taken earlier. I could register and run either of them as long as I did not try to register both at once. I then changed the UUID of one of them and can now register both.
Bill
BillG
Volunteer
 
Posts: 4834
Joined: 19. Sep 2009, 04:44
Location: Sydney, Australia
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 7,8,Server

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby pstein » 15. Sep 2021, 10:55

@BillG: Thank you for reply.

For the first part of your analysis your are right.
Yes, I double clicked again on *.vbox again.

In the past I worked with VmWare. And clicking there on the corresponding *.vmx file will always start the related VM.
Even better Vmware prompts me if the VM was copied or moved .
Is there now way to let Virtualbox ask me in a similar way?

However I am considering to switch from VMware to VirtualBox.

To solve the problem you suggested to click start in VirtualBox Manager or start from vboxmanage.
Sorry for this question: Whats the difference?

However, If I open VirtualBox Manager, select the VM (at the old location) and right click, then the the "Start" context menu is greyed out.
See attached snapshot.

So I guess I have to re-register the VM again.....and the original problem persists.

VirtualBox Manager.png
VirtualBox Manager.png (70.85 KiB) Viewed 1810 times
pstein
 
Posts: 56
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby fth0 » 15. Sep 2021, 11:11

Unregister the "old" VM from the VirtualBox Manager by clicking on "Remove..." in the context menu (see your screenshot ;)). In the appearing dialog, choose "Remove only" just in case. If this works as expected, you can double click on your "new" .vbox file to register it.
fth0
Volunteer
 
Posts: 2455
Joined: 14. Feb 2019, 03:06
Location: Germany
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby BillG » 16. Sep 2021, 01:48

pstein wrote:@BillG: Thank you for reply.

To solve the problem you suggested to click start in VirtualBox Manager or start from vboxmanage.
Sorry for this question: Whats the difference?

]


The difference is that a double click of the .vbox file in VirtualBox registers the vm. Once it is registered, it cannot be registered again, unless you first remove it.

When it is registered, it will appear in the VirtualBox Manager display and you can double-click the vm entry in the VirtualBox Manager window to start it or you can select it and click the green start arrow.

fth0 has told you how to deregister a vm.
Bill
BillG
Volunteer
 
Posts: 4834
Joined: 19. Sep 2009, 04:44
Location: Sydney, Australia
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 7,8,Server

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby pstein » 16. Sep 2021, 13:11

Ok, it works. Thank you.

However as far as I can see I always have to start at first VirtualBox Manager and then inside this Meta-Tool to start the actual VM.

I guess there is a shorter way without intermediate start of VirtualBox Manager.

How can I (most probably from cmdline/shortcut) start a VM directly?
pstein
 
Posts: 56
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby scottgus1 » 16. Sep 2021, 14:10

Right-click the VM, choose Create Shortcut.

On the command line:

CD "C:\Program Files\Oracle\Virtualbox"
vboxmanage startvm "VM name"


The path in the 'CD' line should be the folder Virtualbox is installed in. "C:\Program Files\Oracle\Virtualbox" is the default chosen by the installer. The whole CD line can be skipped if you add the Virtualbox installation folder to your PATH system variable. Or use Mpack's batch file idea here: viewtopic.php?f=6&t=41503#p289755
scottgus1
Site Moderator
 
Posts: 13236
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Moving vbox + VM does not work: Duplicate UUID error?

Postby pstein » 18. Sep 2021, 07:47

Works
Thank you
pstein
 
Posts: 56
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS


Return to VirtualBox on Windows Hosts

Who is online

Users browsing this forum: Google [Bot] and 24 guests