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

Discussions related to using VirtualBox on Windows hosts.
Post Reply
pstein
Posts: 59
Joined: 20. Nov 2008, 20:48
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu, CentOS

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

Post by pstein »

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?
scottgus1
Site Moderator
Posts: 20965
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?

Post by scottgus1 »

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.
Jetras
Posts: 20
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?

Post by Jetras »

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

Code: Select all

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.
scottgus1
Site Moderator
Posts: 20965
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?

Post by scottgus1 »

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.)
pstein
Posts: 59
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?

Post by pstein »

@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?
BillG
Volunteer
Posts: 5100
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

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

Post by BillG »

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
pstein
Posts: 59
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?

Post by pstein »

@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 5273 times
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

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

Post by fth0 »

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.
BillG
Volunteer
Posts: 5100
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

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

Post by BillG »

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
pstein
Posts: 59
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?

Post by pstein »

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?
scottgus1
Site Moderator
Posts: 20965
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?

Post by scottgus1 »

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
pstein
Posts: 59
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?

Post by pstein »

Works
Thank you
Post Reply