codeblog code is freedom — patching my itch


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 

© 2012, Kees Cook. This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Creative Commons License

Be Sociable, Share!


  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 — 2/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 — 7/16/2014 @ 2:53 pm

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Powered by WordPress