Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate GUID on Virtual Machine

I've managed to successfully reproduce the same GUID (yes, you read that correctly) using a simple C#.NET scratch program when reverting snapshots inside VMWare. The client virtual machine is Windows Server 2008 R2 64-bit. I've tried Windows XP and Windows 7 64-bit clients with unsuccessful results. The version of VMWare I'm using is 6.5.3 build-185404. All I do is revert to a previous snapshot, copy the scratch program over to the virtual machine, and then run it.

Some evidence for those that aren't convinced (I don't blame you): http://i.imgur.com/KkSdr.png

Here's the code for the scratch program:

using System;
using System.Globalization;

namespace DuplicateGuid
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(String.Format(CultureInfo.InvariantCulture, "{0} {1}", Guid.NewGuid(), DateTime.Now.Ticks));

            Console.ReadKey();
        }
    }
}

Could anyone shed some light on how this is possible given that the tick count is different?

like image 952
Brent Newbury Avatar asked Apr 20 '11 11:04

Brent Newbury


People also ask

What is UUID of VM?

The UUID is based on the physical computer's identifier and the path to the virtual machine's configuration file. This UUID is generated when you power on or reset the virtual machine. As long as you do not move or copy the virtual machine to another location, the UUID remains constant.

What is GUID vmware?

The GUID is a string of 32 hexadecimal digits, organized in groups of 4, 8, or 12 digits, separated by hyphens. Copy the 32 hexadecimal digits of the GUID, along with the inset hyphens, and save this into a shell variable or a text file. You will use the GUID when you start the plug-in server.


1 Answers

Can please you post one of the GUIDs. The image seems to be broken.

See http://en.wikipedia.org/wiki/Globally_unique_identifier specifically "Algorithm". It is likely the platform you are using under Windows 2008 R2 x64 is using version 4 GUIDs. In this case the GUID is generated using pseudo random data. As the CPU is in the same state because you are reverting it back from what I assume is a memory snapshot (correct?) and not a powered off snapshot you are getting duplicate numbers from the pseudo random generator.

It is reasonably common for the operating system to initialise a pseudo random seed once at startup sequentially pulling numbers from the list to make the appearance of a random number. This happens in the Linux world and it is likely that you are observing the same behaviour. Because the sequence of numbers has not been reinitialised and you are reverting back to a memory image you are getting the same numbers.

Using GUID Generator from VS 2010 I got a V4 GUID on Windows 7.

To fix this issue I would first try to apply Windows security fixes which may fix the issue. The problem mostly likely lies in ole32.dll which is called in the Guid.NewGuid method and possibly newer versions reseed the pseudo random number as you didn't get this on newer Windows versions.

Otherwise to work around this issue on the current platform you could:

  1. Generate your own GUID from MAC and time data as specified in OSF specification.

  2. Try to call new Random() prior to your NewGuid call. This probably would be a long shot, but easy to test.

  3. Don't revert from a memory image.

Hope this helps. No doubt you are not the first to have this problem which is why the newer platforms probably reverted to the previous method of using MAC and time data.

like image 63
Bernie White Avatar answered Sep 24 '22 10:09

Bernie White