Skip to contentSkip to conversation

Extracting system UUID...

DISCUSSION Darryl L. Pierce 3 participants 8 messages Apr 20, 2010

lore
Share & tools
lore
#0 lore raw

Does anything return the UUID for the host system? Such as what was returned by hal with:

(mcpierce@mcpierce-desktop:~)$ hal-get-property --udi \
     /org/freedesktop/Hal/devices/computer --key system.hardware.uuid
00DD19E3-DD3A-DE11-90DA-812C97507C34
Signature · 4 lines
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
#1 lore raw
Quoted 6 lines · Darryl L. Pierce

Does anything return the UUID for the host system? Such as what was returned by hal with:

(mcpierce@mcpierce-desktop:~)$ hal-get-property --udi \
     /org/freedesktop/Hal/devices/computer --key system.hardware.uuid
00DD19E3-DD3A-DE11-90DA-812C97507C34

That's the product UUID key from the DMI data, which you also can read from sysfs:

/sys/devices/virtual/dmi/id/product_uuid

Not sure what you want to use this for, but given that many BIOS vendors just write rubbish to that field, it's mostly useless.

The D-Bus machine ID is usually more useful, as stored in /var/lib/dbus/machine-id. It's nowadays available on virtually all systems and considered part of the D-Bus API, and hence can be reliably be used to identify a system. There's no need to actually use libdbus to read that file.

Lennart

Signature · 3 lines
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4
#2 lore raw
In reply to Darryl L. Pierce
Quoted 6 lines · Darryl L. Pierce

Does anything return the UUID for the host system? Such as what was returned by hal with:

(mcpierce@mcpierce-desktop:~)$ hal-get-property --udi \
     /org/freedesktop/Hal/devices/computer --key system.hardware.uuid
00DD19E3-DD3A-DE11-90DA-812C97507C34

What piece of hardware on the host system would create such a "computer" uuid?

thanks,

greg k-h

#3 lore raw
In reply to Darryl L. Pierce
Quoted 10 lines · Greg KH
Quoted 6 lines · Darryl L. Pierce

Does anything return the UUID for the host system? Such as what was returned by hal with:

(mcpierce@mcpierce-desktop:~)$ hal-get-property --udi \
     /org/freedesktop/Hal/devices/computer --key system.hardware.uuid
00DD19E3-DD3A-DE11-90DA-812C97507C34

What piece of hardware on the host system would create such a "computer" uuid?

I believe it comes from BIOS.

Signature · 4 lines
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
#4 lore raw
In reply to Darryl L. Pierce
Quoted 5 lines · Darryl L. Pierce
Quoted 4 lines · Greg KH
Quoted 3 lines · Darryl L. Pierce

Does anything return the UUID for the host system? Such as what was returned by hal with:

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
(mcpierce@mcpierce-desktop:~)$ hal-get-property --udi \
     /org/freedesktop/Hal/devices/computer --key system.hardware.uuid
00DD19E3-DD3A-DE11-90DA-812C97507C34

What piece of hardware on the host system would create such a "computer" uuid?

I believe it comes from BIOS.

Ah, as Lennart just pointed out, you really don't want to use that, it can't be trusted on a lot of platforms. Unless you don't mind having the same value for lots of different machines :)

What do you want to use this value for?

thanks,

greg k-h

#5 lore raw
In reply to Darryl L. Pierce
Quoted 5 lines · Greg KH

Ah, as Lennart just pointed out, you really don't want to use that, it can't be trusted on a lot of platforms. Unless you don't mind having the same value for lots of different machines :)

What do you want to use this value for?

It's going to be used to persistently and uniquely identify systems in a network. The hostname can't be used since it's possible for a system to come up with a different hostname within DHCP.

Signature · 4 lines
Darryl L. Pierce, Sr. Software Engineer @ Red Hat, Inc.
Delivering value year after year.
Red Hat ranks #1 in value among software vendors.
http://www.redhat.com/promo/vendor/
#6 lore raw
In reply to Darryl L. Pierce
Quoted 10 lines · Darryl L. Pierce
Quoted 5 lines · Greg KH

Ah, as Lennart just pointed out, you really don't want to use that, it can't be trusted on a lot of platforms. Unless you don't mind having the same value for lots of different machines :)

What do you want to use this value for?

It's going to be used to persistently and uniquely identify systems in a network. The hostname can't be used since it's possible for a system to come up with a different hostname within DHCP.

Try using the dbus id like was pointed out. Otherwise you will have lots of problems if people with the same type of machine connect to a network (as is common in business settings.)

good luck,

greg k-h

#7 lore raw
In reply to Darryl L. Pierce
Quoted 10 lines · Darryl L. Pierce
Quoted 5 lines · Greg KH

Ah, as Lennart just pointed out, you really don't want to use that, it can't be trusted on a lot of platforms. Unless you don't mind having the same value for lots of different machines :)

What do you want to use this value for?

It's going to be used to persistently and uniquely identify systems in a network. The hostname can't be used since it's possible for a system to come up with a different hostname within DHCP.

You really should use the D-Bus machine ID for stuff like this (as mentioned). In fact, it was invented just for use cases like that. It is reliably available everywhere, accessible without libdbus, has clearly defined semantics and actually identifies the installation (in contrast to the machine), which more often than not is the actual thing you want to identify (especially in a VM environment, where multiple VMs might end up with the same UUID otherwise if you really read it from the hw, since after all you run multiple VMs on the same physical hw).

See the man page for more information about the D-Bus machine id:

http://linux.die.net/man/1/dbus-uuidgen

Lennart

Signature · 3 lines
Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net
http://0pointer.net/lennart/           GnuPG 0x1A015CC4