# dmidecode --string system-uuid

I'm using the code above get the UUID on each host in my environment. As far as I understand the UUID should not change between different Linux distributions on the same host with the same hardware configuration. But after some tests on different Linux distributions I encountered different uuid with this same command.

It seems that older dmidecode version will get different UUID result.

For example dmidecode 2.9 from SLES11.2 result with string A and dmidecode 2.12 from Debian 8 result with string B.

How can I get the same uuid no matter the Linux distribution I deploy on my machine?

Additional information:

I wanted to use dmidecode and not MAC address as UUID because i saw that if I replace my network adapter or some other hardware's settings the UUID will not change.

What I need is some unique identifier that I can have on my machine to identify it across minor hardware changes and different OS. Using dmidecode cannot be fake in some level I guess instead of just generating UUID and writing it to a file and using it.

I'm working with VMware and machine clones are often used and that's why I need something that will not be replicated with the clone.

  • what do you need to know is the same? the distro and version? – Skaperen Jun 22 '15 at 12:32
  • Not sure about system-uuid, but would the NIC's MAC-address work? – frostschutz Jun 22 '15 at 12:48
  • The uuid represents the host in my data base and that how I know what record to update. Do you recommend using mac address as my uuid? – Asaf Magen Jun 22 '15 at 13:19
  • What are the two values from dmidecdode? And if these were installed from a package what is that package information for that? – rocky Jun 22 '15 at 14:24
  • the value are uuid strings but they are different from one to another depending on the dmidecode version. it does not matter from what package dmidecode come from but the bin version. for example dmidecode 2.9 from sles11.2 result with string A and dmidecode 2.12 from debian 8 result with string B.(i don't want to publish the strings because of security matters). my main question is how to get one repeated uuid between all os's on the same host. – Asaf Magen Jun 22 '15 at 15:37

It's sw, it changes whether you want it or not :)

I wouldn't rely on it (and pretty much on any sw or hw-based auto-detected info) for a DB index - both hw and sw may have to be changed and if the info changes as a result you have to start over. Could be even worse - if you can get duplicates your DB will be in trouble.

I'd use an asset management tool for the index - to guarantee its uniqueness - and I'd map the auto-detected info (MAC, HDD, RAM, CPU, uuid, whatever) to the index but as separate/independent values, not blobbed up into a single value. This way you would locate the machine by single/multi-value queries (in most cases), falling back to the index/asset management system as needed. You can also handle hw/sw upgrades/swaps which add/change/remove one or more of the info values (updated uuid, for example).

|improve this answer|||||
  • Or use one of the numerous FOSS tool to do it for me... – MUY Belgium Feb 4 '19 at 10:18

I use hostname:

 i = gethostname(tmp,2047); 
 if (i)                     /* found host name */

which if not changing a lot :-) is good.

|improve this answer|||||
  • I think that the question requires id "to identify it across minor hardware changes and different OS". A hostname can be hardly used for reliable identification across OS. – Zaboj Campula Jan 24 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.