codeblog code is freedom — patching my itch

February 10, 2012

kvm and product_uuid

Filed under: Chrome OS,Debian,Ubuntu,Ubuntu-Server — kees @ 10:08 am

While looking for something to use as a system-unique fall-back when a TPM is not available, I looked at /sys/devices/virtual/dmi/id/product_uuid (same as dmidecode‘s “System Information / UUID”), but was disappointed when, under KVM, the file was missing (and running dmidecode crashes KVM *cough*). However, after a quick check, I noticed that KVM supports the “-uuid” option to set the value of /sys/devices/virtual/dmi/id/product_uuid. Looks like libvirt supports this under capabilities / host / uuid in the XML, too.

host# kvm -uuid 12345678-ABCD-1234-ABCD-1234567890AB ...
host# ssh localhost ...
...
guest# cat /sys/devices/virtual/dmi/id/product_uuid 
12345678-ABCD-1234-ABCD-1234567890AB

© 2012, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 License.
CC BY-SA 4.0

2 Comments

  1. Huh. I’d always been using /sys/class/dmi. Seems /sys/devices/virtual/dmi works too, if you like typing a longer path ;-)

    Comment by Andrew Pollock — February 12, 2012 @ 11:04 pm

  2. Hey this works great for our Ubuntu servers, but it DOES NOT work for my Mac Mini or my Mac Air which is however linux based. How would I get a similar UUID for a mac OsX?

    Comment by Sam Fullman — July 16, 2014 @ 2:53 pm

Powered by WordPress