Skip to content

Instantly share code, notes, and snippets.

@UniversalSuperBox
Last active July 1, 2019 16:43
Show Gist options
  • Save UniversalSuperBox/85838f0bfb4494d2fe33ff5214f41a94 to your computer and use it in GitHub Desktop.
Save UniversalSuperBox/85838f0bfb4494d2fe33ff5214f41a94 to your computer and use it in GitHub Desktop.
Fake your computer model using libvirtd

Sometimes you want to test how an operating system will behave if you act like you're using a different computer model than you really are. For those cases, libvirtd with KVM comes in handy. We can change the model of our computer (the one returned by wmic csproduct get name, specifically) very easily. This can be used with machines created in virt-manager, but the application itself does not provide this configuration for us.

First, open up your configuration with the following command:

virsh edit [VM name]

Now we only need to add a few lines of configuration to the file. Inside the <os> tag, add the following:

<smbios mode='sysinfo'/>

Now to change the model of the PC, we'll want to add a <sysinfo> entry. This goes inside the <domain> tags, so the second-to-top level of the configuration file:

<sysinfo type='smbios'>
  <system>
    <entry name='product'>I built this computer</entry>
  </system>
</sysinfo>

Close the file to have virsh verify your changes, then boot your VM. Enjoy your custom computer model!

This file references the domain format documentation for libvirt, there are many more sysinfo fields that you can fill in: https://libvirt.org/formatdomain.html#elementsSysinfo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment